RadDataPager Question

2 posts, 0 answers
  1. robertw102
    robertw102 avatar
    265 posts
    Member since:
    Jul 2007

    Posted 23 Mar 2010 Link to this post

    My situation is that I have a RadListView with RadDataPager, to display a bunch of calendars. I set the datasource of the RadListView in the code-behind and everything loads correctly. The problem is that the paging functionality does not work. I've created test page that replicates my issue.

    My ASPX page:
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml"
    <head runat="server"
        <form id="form1" runat="server"
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
            <telerik:RadListView ID="lvItems" runat="server" AllowPaging="true"
                    <telerik:RadDataPager ID="dpTopPager" runat="server" PagedControlID="lvItems" PageSize="7" 
                            <telerik:RadDataPagerButtonField FieldType="Numeric" PageButtonCount="10" /> 
                    <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder> 
                        <%#DataBinder.Eval(Container, "DataItem.Value") %> 

    The code-behind:
    using System; 
    using System.Collections.Generic; 
    using System.Linq; 
    using System.Web; 
    using System.Web.UI; 
    using System.Web.UI.WebControls; 
    public partial class Test : System.Web.UI.Page 
        protected void Page_Load(object sender, EventArgs e) 
            if (!Page.IsPostBack) 
                Dictionary<intint> items = new Dictionary<intint>(); 
                for (int i = 0; i < 23; i++) 
                    items.Add(i, i); 
                lvItems.DataSource = items.ToList(); 

    It's a simple demo, it just renders numbers. Now I notice that because I only bind my results on the first load that the paging doesn't work. I noticed that the normal asp.net DataPager control acts the same way, so is it just not possible to enable paging if I don't rebind the RadListView every time the page is changed or am I doing something wrong.?

  2. Rosen
    Rosen avatar
    3253 posts

    Posted 25 Mar 2010 Link to this post

    Hi Robert,

    In your scenario you should consider using Advanced DataBinding through NeedDataSource event. As you may know NeedDataSource event will be raised only when the data is needed i.e. on paging, sorting, filtering etc. 

    All the best,
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top