This is a migrated thread and some comments may be shown as answers.

Raddock Portal Dynamic User Control Paging.

2 Answers 51 Views
Dock
This is a migrated thread and some comments may be shown as answers.
CG
Top achievements
Rank 1
CG asked on 04 Jun 2011, 09:17 PM
Hello,

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

http://demos.telerik.com/aspnet-ajax/dock/examples/myportal/defaultcs.aspx

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 %>
             of
             <%#Container.PageCount %>
   </span>
   <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 %>" />
</div>

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?

Thanks!

2 Answers, 1 is accepted

Sort by
0
CG
Top achievements
Rank 1
answered on 06 Jun 2011, 03:40 PM
Can someone please look into this? Thanks! :)
0
Pero
Telerik team
answered on 07 Jun 2011, 11:34 AM
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,
Pero
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.

Tags
Dock
Asked by
CG
Top achievements
Rank 1
Answers by
CG
Top achievements
Rank 1
Pero
Telerik team
Share this question
or