Pagination of ASP. NET-gridview

Source: Internet
Author: User
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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.