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

[Solved] Paging: only 1st page has rows

2 Answers 53 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 15 Apr 2013, 12:37 AM

Only the 1st page has any rows, so what am I missing?  Here's the code:

<telerik:RadGrid ID="RadGridHistPats" runat="server" AutoGenerateColumns="False"
Skin="Outlook" AllowPaging="true" PageSize="10">
<MasterTableView >
<Columns>
<telerik:GridBoundColumn DataField="PatientID"
HeaderText="PatientID" UniqueName="PatientID">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        DataTable dt = new DataTable();
        dt.Columns.Add("PatientID");
        for (int iCount = 0; iCount < 200; iCount++)
        {
            DataRow dr = dt.NewRow();
            dr["PatientID"] = iCount.ToString();
            dt.Rows.Add(dr);
        }
        RadGridHistPats.DataSource = dt;
        RadGridHistPats.DataBind();
    }
}


2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 15 Apr 2013, 06:33 AM
Hi,

In order to implement advanced features in grid like paging make sure that it uses NeedDataSource event to bind the grid. Check the following help documentation for more.
Advanced Data-binding (using NeedDataSource event)

Thanks,
Shinu
0
Scott
Top achievements
Rank 1
answered on 15 Apr 2013, 03:34 PM
Thank you, Shinu, that is the issue.  Unfortunately, the documentation only mentions NeedDataSource as a requirement for Custom Paging (which I wasn't using) so I did not see this as a requirement for standard Paging.  This lack of consistency in the documentation is a continuing frustration for me; everytime I try using a new Telerik control or feature, I spend way too much time discovering the 'gotchas' the hard way (like this forum posting).  I suggest that Telerik adds this NeedDataSource requirement to the RadGrid>Paging>BasicPaging page (http://www.telerik.com/help/aspnet-ajax/grid-basic-paging.html) so others don't have to search Forums for this discussion.  And, if it's not already listed in the Sorting or Editing sections for RadGrid, I suggest it be added there as well.
Tags
Grid
Asked by
Scott
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Scott
Top achievements
Rank 1
Share this question
or