Datagrid built in paging support
One disadvantage of using the DataGrid control's built-in paging support is performance. When you use the method of paging through records discussed in the preceding section, all the records must be retrieved from the data source every time you navigate to a new page. So, if you are paging through a database table with 2 million records, those 2 million records must be retrieved into memory every time you move to a new page.
1) AllowPaging Property to true.
2) PageSize to number of records display per page. Eg: 10.
3) Write Code on Event.
private void DGridEmp_PageIndexChanged(object source,
System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DGridEmp.CurrentPageIndex = e.NewPageIndex;
BindGrid(fetchData());
}
No comments:
Post a Comment