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

RadDataPager Question

1 Answer 70 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
robertw102 asked on 23 Mar 2010, 08:39 PM
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" ""> 
<html xmlns=""
<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 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.?


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 25 Mar 2010, 07:46 AM
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.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question