Raddock Portal Dynamic User Control Paging.

3 posts, 0 answers
  1. CG
    CG avatar
    31 posts
    Member since:
    Sep 2010

    Posted 04 Jun 2011 Link to this post


    I've created a portal page much like the one from this example:


    My problem is that I have one particular dock with a dynamic user control containing a RadListView. I've set AllowPaging = true and created the Paging mechanism as such in my LayoutTemplate:
    <div style="float: left; margin-left: 30%;">
        <asp:Button runat="server" ID="btnFirst" CommandName="Page" CommandArgument="First"  
                 Text="First" Enabled="<%#Container.CurrentPageIndex > 0 %>" Font-Size="10px" />
        <asp:Button runat="server" ID="btnPrev" CommandName="Page" CommandArgument="Prev"
                 Text="Prev" Enabled="<%#Container.CurrentPageIndex > 0 %>" Font-Size="10px" />
        <span style="vertical-align: top; position: relative; top: 4px">Page
                <%#Container.CurrentPageIndex + 1 %>
                 <%#Container.PageCount %>
       <asp:Button runat="server" ID="btnNext" CommandName="Page" CommandArgument="Next" Font-Size="10px"
                Text="Next" Enabled="<%#Container.CurrentPageIndex + 1 < Container.PageCount %>" />
        <asp:Button runat="server" ID="btnLast" CommandName="Page" CommandArgument="Last" Font-Size="10px"
                  Text="Last" Enabled="<%#Container.CurrentPageIndex + 1 < Container.PageCount %>" />

    My problem is that the paging isn't working as in the example. In the example you have a datasource from a .rss, but in my code I am linking the datasource to a List<T> type. I also noticed that every time i press 'next' or 'prev' it triggers the page_load or onneeddatasource methods which recreate and bind the data again...so maybe this is whats causing the issue. But I don't know how to get around to this. I tried using Page.Ispostback in my user Control but fail to get the correct postback because it is getting the state of the Parent page's postback and not the usercontrol's.
    Does anybody know how to set up paging correctly in this scenario?

  2. CG
    CG avatar
    31 posts
    Member since:
    Sep 2010

    Posted 06 Jun 2011 Link to this post

    Can someone please look into this? Thanks! :)
  3. Pero
    Pero avatar
    1156 posts

    Posted 07 Jun 2011 Link to this post

    Hi CG,

    RadListView requires a postback or ajax call to perform paging, so the NeedDataSource event will be fired to rebind the control to the new data and settings.
    In your case you should bind the control to the same data in the NeedDataSource event handler method. Moreover, the ListView should be placed in UpdatePanel to prevent updating the entire RadDockLayout. For your convenience I have implemented a sample project that adds RadListView control to a dynamically created dock. Please find it attached to the thread. You'll notice that everything works as expected.

    All the best,
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top