ASP.NET provides a many for showing data and GridView Control is one of them. GridView control, used for all CRUD operation display, edit and delete data from different kinds of data sources.
As Gridview is used to display huge amount of data, its make page very clumsy id displaying all data in one page, so there is concept of paging the data in grid view and view records page by page.
First need to do the allowPaging=true; it activate the paging concept in grid; and pazeSize=10 it defined the number of item to display in the grid;
<asp:GridView ID="grdView" AllowPaging="True" PageSize="10" AllowCustomPaging="False"
<asp:GridView ID="grdView" BorderWidth="1px" AllowPaging="True" PageSize="10" runat="server" AutoGenerateColumns="false" Width="1 EmptyDataText="*No record found" OnPageIndexChanging="grdView_PageIndexChanging"
Now handling the pageIndex event in code behind c#.
protected void grdView_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
grdView.PageIndex = e.NewPageIndex;// Chanding the page index
BindGridView(); // Again bind the grid view
}
No comments:
Post a Comment