How to Use the aspnetpager. dll paging control and sample code

Source: Internet
Author: User

: Http://www.webdiyer.com/Products/AspNetPager/Downloads

Aspnetpager paging example: http://www.webdiyer.com/AspNetPagerDemo/ApplyStyles/default.aspx

After the download, you can pull the control into vs. Note that vs2003 cannot be used! The following code is used:

Protected void pagerw.pagechanged (Object sender, eventargs E)
{
Oracleconnection objcon = This. getcon ();
String querystr = "select * from Stu ";
Oracledataadapter da = new oracledataadapter (querystr, objcon );
Dataset DS = new dataset ();
Da. Fill (DS, "Stu ");
This. gridview1.datasource = This. getpage (DS);/*** the main steps are as follows ***/
This. gridview1.databind ();
}

Public pageddatasource getpage (Dataset DS)
{
This. pager1.recordcount = Ds. Tables [0]. Rows. count;
Pageddatasource PPS = new pageddatasource ();
PDS. datasource = Ds. Tables [0]. defaultview;
PPS. allowpaging = true;
PDS. currentpageindex = pager1.currentpageindex-1;
PPS. pagesize = pager1.pagesize;
Return PPS;
}

You just need to replace the interaction between the Code and the database with your own, that's OK! Try it!

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.