I want custom pagination in my gridview control. The first option is to fetch only required row from the data base. But what I want is I am fetching all rows from the database and storing them into datatable. Now is there any option that I can bind only some of the rows of datatable to gridview based on page size and page index so that I no need to connect to database every time on page change event?
Asked
Active
Viewed 395 times
1
-
be sure to use the green checkbox to mark the 'best answer'! It's part of the reputation system at StackOverflow. – – Muhammad Akhtar Apr 20 '11 at 17:55
1 Answers
1
You have to handle the Gridview PageIndexChanging
event and setup a New page index.
like...
protected void gridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gridView.PageIndex = e.NewPageIndex;
gridView.DataSource = (DataTable)Session["DataTable"];
gridView.DataBind();
}

Off The Gold
- 1,228
- 15
- 28

Muhammad Akhtar
- 51,913
- 37
- 138
- 191
-
Thanks Muhammad for you response.. But this will do the default paging and will not help me in custom paging.... – Microsoft Developer Apr 20 '11 at 08:01