In a ASP.NET Gridview we use the event PageIndexChanging to do the custom paging. i use RadGrid i want to implement Paging. i enabled paging in the Radgrid and i have selected the option for Custom Paging. i looked for the event PageIndexChanging but i found the PageIndexChanged that was the only thing that is close to the one i know. i have added the following code to do custom paging.
protected void RadReplies_PageIndexChanged(object source, GridPageChangedEventArgs e) |
{ |
RadReplies.PageIndexChanged = e.NewPageIndex; |
Bind_Posts(); |
} |
i don't get any Error. When i run my page it show the first 5 records and when i move to the next page it shows nothing. The method Bind_Posts() it rebind the grid.
Can you tell me if there is anything that am doing wrong
Thanks
5 Answers, 1 is accepted
Please refer to the articles below for more information about how to implement RadGrid with custom paging
Custom Paging
Help topic
I hope this gets you started properly.
Greetings,
Pavlina
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.

Thank you for your reply. i think it should be best if i explan my problem statement. First i have two Radgrid in one page. First grid is set the visible property to true and the second one is set to false. Now when the User click a button in the first Grid it will give him related records in the second grid and the First Grid will be hiden and the second grid's visible property will be set to true and i will bind that grid with data. Now the Data is there, there are more than 16 records and i want it to display 5 records per page in the paging. The 5 records are displayed now , but i cant get to the next 5 of the 16 records. This is how my second Grid is defined
<telerik:RadGrid ID="RadReplies" runat="server" Skin="Sunset" AutoGenerateColumns="False" OnItemCommand="RadReplies_ItemCommand" GridLines="Vertical" OnItemDataBound="RadReplies_ItemDataBound" OnDataBound="RadReplies_DataBound" AllowPaging="True" OnPageIndexChanged="RadReplies_PageIndexChanged" PageSize="5" AllowCustomPaging="True" OnNeedDataSource="RadReplies_NeedDataSource" Visible="False"> |
<MasterTableView DataKeyNames="ID" |
Width="100%" |
ClientDataKeyNames="ID" > |
<RowIndicatorColumn> |
<HeaderStyle Width="20px" /> |
</RowIndicatorColumn> |
<ExpandCollapseColumn> |
<HeaderStyle Width="20px" /> |
</ExpandCollapseColumn> |
<Columns> |
<telerik:GridTemplateColumn DataField="ID" HeaderText="ID" UniqueName="ID"> |
<ItemTemplate> |
<asp:Label ID="lblIDreply" runat="server" Text='<%# Eval("ID")%>'></asp:Label> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridTemplateColumn ColumnEditorID="User" CurrentFilterValue="User" DataField="User" |
HeaderImageUrl="images/System/userinfo.gif" HeaderText="User" UniqueName="User"> |
<ItemTemplate> |
<asp:Image ID="imguser" runat="server" ImageUrl="images/System/userinfo.gif" /> |
<asp:Label ID="lblUsername" runat="server" Text='<%# Eval("Username")%>'></asp:Label> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridTemplateColumn HeaderText="Subject" UniqueName="Subject"> |
<ItemTemplate> |
<asp:Label ID="lblSubject" runat="server" Text='<%# Eval("SUBJECT")%>'></asp:Label> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridTemplateColumn HeaderText="Message" UniqueName="Message"> |
<ItemTemplate> |
<asp:Label ID="lblMESSAGE" runat="server" Text='<%# Eval("MESSAGE")%>'></asp:Label> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridTemplateColumn HeaderText="Date" UniqueName="Date"> |
<ItemTemplate> |
<asp:Label ID="lblAddedDate" runat="server" Text='<%# Eval("AddedDate")%>'></asp:Label> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridTemplateColumn UniqueName="Edit"> |
<ItemTemplate> |
<asp:Button ID="lnkEdit" OnClientClick = "GetSelectedNames()" CommandName="EDITREPLY" CommandArgument="EDITREPLY" Text="Edit" runat="server" /> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridTemplateColumn UniqueName="Reply"> |
<ItemTemplate> |
<asp:Button ID="lnkButtonReply" CommandName="Reply" Text="Reply" runat="server" /> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
</Columns> |
</MasterTableView> |
<ClientSettings> |
<Selecting AllowRowSelect="True" /> |
</ClientSettings> |
<FilterMenu EnableTheming="True" Skin="Sunset"> |
<CollapseAnimation Duration="200" Type="OutQuint" /> |
</FilterMenu> |
<PagerStyle AlwaysVisible="True" /> |
</telerik:RadGrid> |
i followed this link to do this
http://www.telerik.com/help/aspnet-ajax/grdsimpledatabinding.html
and my event looks like this
protected void RadReplies_PageIndexChanged(object source, GridPageChangedEventArgs e) |
{ |
RadReplies.CurrentPageIndex = e.NewPageIndex; |
Bind_Posts(); |
} |
and the Bind_Post() method is defined like this
private void Bind_Posts() |
{ |
BLL.BLL obj = new BLL.BLL(); |
DataSet ds; |
int ForumID = 0; |
//Get Forum ID |
ForumID = obj.Get_ID_of_Category("General Questions"); |
try |
{ |
ds = obj.Get_Forum_Post(ForumID); |
if (ds.Tables[0].Rows.Count > 0) |
{ |
RadGrid1.DataSource = ds; |
RadGrid1.DataBind(); |
} |
else |
{ |
RadGrid1.Visible = false; |
lblMessage.Text = "No Post have been posted yet on this Forum"; |
} |
} |
catch (ApplicationException ex) |
{ |
lblMessage.Text = ex.Message; |
} |
finally |
{ |
obj = null; |
} |
} |
I hope i explained well.
Thanks
Vuyiswa Maseko
Please, refer to the following forum thread which elaborates on this matter and let me know if it helps:
http://www.telerik.com/community/forums/aspnet-ajax/grid/how-to-handle-pagesizechanged-event.aspx
Best wishes,
Pavlina
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.

helloI havea problemwiththepagingof a hierarchicalgridbecausewhenI changepage itemclosesthegridthefillinga gridisthecallstoreprocedureI'musingthecode
canyouhelp please
<telerik:RadGrid ID="gridSubHistorial" runat="server" AllowSorting="true" EnableLinqExpressions="false"onpageindexchanged="gridSubHistorial_PageIndexChanged1"
AllowMultiRowSelection="False" ShowFooter="true" GridLines="None" AllowPaging="True">
<MasterTableView ShowHeader="true" AutoGenerateColumns="true" AllowPaging="true" AllowMultiColumnSorting="true" ShowGroupFooter="true" GroupLoadMode="Server"
PageSize="3"HierarchyLoadMode="ServerOnDemand" PagerStyle-PageSizeLabelText="Page size:3">
</MasterTableView>
</telerik:RadGrid>
Code Behind
Protected void gridSubHistorial_PageIndexChanged1(object sender, GridPageChangedEventArgs e)
{
RadGrid grd = (sender) as RadGrid;
grd.CurrentPageIndex = e.NewPageIndex;
var d = (((GridDataItem)e.Item).ChildItem.FindControl("InnerContainer").FindControl("Multipage1").FindControl("PageView1").FindControl("gridSubHistorial")) as RadGrid;
idMonedero =
Convert.ToString((e.Item as GridDataItem).GetDataKeyValue("Monedero"));
consultamMonedero.
DataAcces consultaSubMon = new consultamMonedero.DataAcces();
d.DataSource = consultaSubMon.spGetSubHistorialMonedero(u.Cuenta, idMonedero);
d.DataBind();
}
Note that hierarchical grid structure is not supported with simple data-binding (calling DataBind). For advanced features like grouping, hierarchy presentation, filtering. etc. Telerik RadGrid requires advanced data-binding through its NeedDataSource event or a data source control. You can refer to the online examples below for more information declarative and programmatic binding of hierarchy grid:
http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/declarativerelations/defaultvb.aspx
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/detailtabledatabind/defaultvb.aspx
All the best,
Pavlina
the Telerik team