Several paging methods in Asp.net (I think it's quite practical)

Source: Internet
Author: User
From: http://bbs.51js.com/viewthread.php? Tid = 3404

1. Use the built-in paging function of the DataGrid

Add the following statement to the properties of the DataGrid Control:
Allowpaging = "true"
Pagesize = "5"
Pagerstyle-horizontalalign = "right"

Note: allowpaging allows paging. Pagesize indicates the number of records displayed on each page. If not written, 10 records are displayed by default. Pagerstyle-horizontalalign specifies the position of the pagination button. The default value is left.

2. Use SQL statements

Select top @ pagesize * From topic where id not in (select top @ pagesize * @ pagenum ID from topic)

Note: @ pagesize indicates the number of records displayed on each page, and @ pagenum indicates the page number.
In addition, topic is the table name and ID is an identifier column.

3. Use dataset. Fill

Dataset DS = new dataset ();
Sqldataadapter myadapter = new sqldataadapter (strsel, Conn );
Myadapter. Fill (DS, startindex, pagesize, "guest ");
Mydatalist. datasource = Ds. Tables ["guest"]. defaultview;

Note: startindex refers to the number of records read, and pagesize refers to the number of records to read. 4. Use datatable. Rows

For I = nstart to nend
Response. Write (Dt. Rows (I) ("itemname") & "<br> ")
Next

Note: nstart indicates the sequence number of the record to be read, and nend indicates the sequence number of the last read record.
DT is a datatable object.

Additional help documentation (basically all downloaded from 51js (carefree script), good)
/Files/dotnetdoor/css2.zip
/Files/dotnetdoor/DOM2-Core.zip
/Files/dotnetdoor/html40.zip

/Files/dotnetdoor/websites_color.rar
/Files/dotnetdoor/xmlhttp.rar
/Files/dotnetdoor/chm.rar
/Files/dotnetdoor/designpatten.rar
/Files/dotnetdoor/iewebcontrols.rar
/Files/dotnetdoor/jsdoc.rar

/Files/dotnetdoor/thinkinjava.rar

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.