Good day.
I inherited a document lister, and I swapped the list over to be a RadListView. The paging just worked as it was without switching to RadDataPager, and without setting AllowCustomPaging.
However, I want to be able to limit the amount of data that will be paged. The list is bound to an IQueryable of documents, and this queries in to a DB which returns dozens (or more) records. However, I only want to be able to page through X number of pages. For instance, the list I am binding to had a count of 100, but I only want to set paging to 5 per page, with a maximum of 15 (total of 3 pages).
I tried applying AllowCustomPaging=true, and using the VirtualItemCount=15, and it does cap it at a max of 15 records, but now my paging links don't work (presumably because I am not handling all of the right events and doing all I have to do to implement custom paging).
Is there something simple I can do to the following code to simply limit the total number of pages/records, or am I going to have to fully implement custom paging? Otherwise, if I switch to using RadDataPager, can this limit the total number of records? If so, how?
Thanks,
Chris
Here is the aspx code:
I inherited a document lister, and I swapped the list over to be a RadListView. The paging just worked as it was without switching to RadDataPager, and without setting AllowCustomPaging.
However, I want to be able to limit the amount of data that will be paged. The list is bound to an IQueryable of documents, and this queries in to a DB which returns dozens (or more) records. However, I only want to be able to page through X number of pages. For instance, the list I am binding to had a count of 100, but I only want to set paging to 5 per page, with a maximum of 15 (total of 3 pages).
I tried applying AllowCustomPaging=true, and using the VirtualItemCount=15, and it does cap it at a max of 15 records, but now my paging links don't work (presumably because I am not handling all of the right events and doing all I have to do to implement custom paging).
Is there something simple I can do to the following code to simply limit the total number of pages/records, or am I going to have to fully implement custom paging? Otherwise, if I switch to using RadDataPager, can this limit the total number of records? If so, how?
Thanks,
Chris
Here is the aspx code:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div class="WidgetDocumentBullet WidgetLink">
<ul id="DocumentsList" runat="server">
<telerik:RadListView ID="RadListView1" runat="server"
ItemPlaceholderID="LatestDocsContainer" PageSize="5" AllowPaging="true" EnableTheming="true" OnNeedDataSource="RadListView1_NeedDataSource" >
<LayoutTemplate>
<asp:Panel ID="PanelLatestDocs" Width="100%" runat="server">
<asp:PlaceHolder ID="LatestDocsContainer" runat="server"/>
<div style="text-align:center;padding-top:10px">
<asp:LinkButton runat="server" ID="btnPrev" CommandName="Page" CommandArgument="Prev"
Text="Prev" Enabled="<%#Container.CurrentPageIndex > 0 %>" />
<span style="vertical-align: top; position: relative;">
<%#Container.CurrentPageIndex + 1 %>
of
<%#Container.PageCount %></span>
<asp:LinkButton runat="server" ID="btnNext" CommandName="Page" CommandArgument="Next"
Text="Next" Enabled="<%#Container.CurrentPageIndex + 1 < Container.PageCount %>" />
</div>
</asp:Panel>
</LayoutTemplate>
<ItemTemplate>
<li>
<a target="_blank" runat="server" id="link" href='<%# ((Web.WidgetFramework.Utilities.DocumentDisplay) Container.DataItem).Link %>'>
<%# ((Web.WidgetFramework.Utilities.DocumentDisplay)Container.DataItem).Name%>
</a> <nobr><small style="color:Black;"><%# ((Web.WidgetFramework.Utilities.DocumentDisplay)Container.DataItem).Date.ToString("MMMM d, yyyy")%></small></nobr>
</li>
<br />
</ItemTemplate>
</telerik:RadListView>
</ul>
</div>
</ContentTemplate>
</asp:UpdatePanel>