Click here to Skip to main content
15,889,176 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a gridview on a page which has AllowPaging=True & PageSize=5. When I click on say page 2, it does a postback, instead of showing the next 5 records. My datasource for the grid is set to a list of objects (ie List<account>) Anyone know why this is happening?
Posted

1 solution

XML
<asp:gridview id="grdUsers" runat="server" allowpaging="True" autogeneratecolumns="False" onpageindexchanging="grdUsers_PageIndexChanging" xmlns:asp="#unknown">
</asp:gridview>

C#
protected void grdUsers_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
grdUsers.PageIndex = e.NewPageIndex;
LoadData();//need to bind the grid again
}


If this helped you then please Vote and accept as Answer.:rose:
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900