Gridview custom page

Source: Internet
Author: User
This control provides convenient paging. You can implement various paging functions by simply setting Visual Studio. NET 2005.

1. Default paging Mode
(1) Whether paging is allowed
The allowpaging attribute of the gridview.

(2) number of records per page
Pagesize of the gridview

(3) pagination navigation bar
The mode of the pagersettings attribute of the gridview: numeric, nextprevious, nextpreviusfirstlast, and numericfirstlast.

2. Custom Paging
(1) Current page

<Asp: Label id = "labelcurrentpage" runat = "server"
TEXT = "<% # (gridview) container. namingcontainer). pageindex + 1%>"> </ASP: Label>

(2) Total number of pages <asp: Label id = "labelpagecount" runat = "server"
TEXT = "<% # (gridview) container. namingcontainer). pagecount %>"> </ASP: Label>

(3) homepage, Previous Page, next page, and last page <asp: linkbutton id = "linkbuttonfirstpage" runat = "server" commandargument = "first" commandname = "page"
Visible = "<% # (gridview) container. namingcontainer). pageindex! = 0%> "> homepage </ASP: linkbutton>

<Asp: linkbutton id = "linkbuttonpreviouspage" runat = "server" commandargument = "Prev" commandname = "page"
Visible = "<% # (gridview) container. namingcontainer). pageindex! = 0%> "> previous page </ASP: linkbutton>

<Asp: linkbutton id = "linkbuttonnextpage" runat = "server" commandargument = "Next" commandname = "page"
Visible = "<% # (gridview) container. namingcontainer). pageindex! = (Gridview) container. namingcontainer). pagecount-1%> "> next page </ASP: linkbutton>

<Asp: linkbutton id = "linkbuttonlastpage" runat = "server" commandargument = "last" commandname = "page"
Visible = "<% # (gridview) container. namingcontainer). pageindex! = (Gridview) container. namingcontainer). pagecount-1%> "> last page </ASP: linkbutton>

 

Note: Write the preceding custom code in the <pagertemplate> </pagertemplate> label of the gridview.

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.