ASP. NET-gridview paging Function
To implement the grdview page function.
The procedure is as follows:
1. Change the allowpaging attribute of the grdview control to true.
2. Change the pagesize attribute of the grdview control to any value (10 by default)
3. Change pagesetting-> mode of the grdview control to numeric (default: Numeric). This attribute is a paging style.
After the gridview property is set, the page style is displayed on the page.
Now we start to implement the paging function:
1. After <asp: gridview id =...>, add onpageindexchanging = "gridview1_pageindexchanging"
2. Add the following in the corresponding Aspx. CS:
Protected void gridview1_pageindexchanging (Object sender, gridviewpageeventargs E)
{
Gridview1.pageindex = E. newpageindex;
Initpage (); // rebind the function of the gridview data
}
3,
Gridview1.pageindex = E. newpageindex;
Then re-bind the gridview.
|