Today, we will share with you the following points: "ASP. NET data control references aspnetpager. dll paging:
1. It may be a bit elementary to explain. I hope that the experts will not "spray" me, because I know that not everyone is a master. I am also afraid that the experts will say that I am 13, and I am not a minor;
2. If there is anything wrong with it, I hope you can point out that you must learn it modestly;
3. This article is original to the author and respects the fruits of others' work. For more information, see the author. Thank you.
Let's start with the following:
Step 1: first download an aspnetpager. dll http://files.cnblogs.com/tandyshen/AspNetPager.rar
Step 2: Reference aspnetpager. dll in the bin folder of the project
Step 3: add the aspnetpager control in the toolbox,
Next
In this way, we have successfully added the aspnetpager control and dragged it to the page for use! → _ → Well, it's a step away from success...
Step 4:CodeFor example, the repeater control is used for other data controls, such as the gridview and datalist...
Front-end code:
<Webdiyer: aspnetpager id ="Aspnetpager1"Runat ="Server"Pagesize ="10"
Horizontalalign ="Center"Width ="100%"
Meta: resourcekey ="Aspnetpager1"Style ="Font-size: 14px"
Alwaysshow ="False"Firstpagetext ="Homepage"Lastpagetext ="Last page"Nextpagetext ="Next Page"
Prevpagetext ="Previous Page"Submitbuttontext ="Go"Submitbuttonclass ="Submitbtn"
Custominfostyle ="Font-size: 14px; text-align: left;"
Inputboxstyle ="Width: 25px; Border: 1px solid #999999; text-align: center;"
Textbeforeinputbox ="Go to"Textafterinputbox ="Page"Pageindexboxtype ="Textbox"
Showpageindexbox ="Always"Textafterpageindexbox ="Page"
Textbeforepageindexbox ="Go"Font-size ="14px"Custominfohtml ="Total & lt; font color = '# ff0000' & gt; % pagecount % & lt;/font & gt; pages, page <font color = '# ff0000'> % currentpageindex % </font>"
Showcustominfosection ="Left"Custominfosectionwidth ="19%"
Pagingbuttonspacing ="3px"Onpagechanged ="Aspnetpager1_pagechanged">
</Webdiyer: aspnetpager>
Background code:
Private VoidDatasbind ()
{
This. aspnetpager1.recordcount = Ds. Tables [0]. Rows. count;
Pageddatasource PPS = new pageddatasource ();
PPS. allowpaging = true;
PPS. pagesize = aspnetpager1.pagesize;
PPS. currentpageindex = aspnetpager1.currentpageindex-1;
PDS. datasource = Ds. Tables [0]. defaultview;
Rpttandy. datasource = PPS;
Rpttandy. databind ();
}
Protected VoidAspnetpager1_pagechanged (ObjectSender, eventargs E)
{
Datasbind ();
}
The red part is the key code ~
Well, the above is what I shared with you today using aspnetpager. DLL's paging method for the Asp.net server controls. I think I have explained it in detail. There are not only text and code, but also images. At the top of it! This mainly paves the way for me to share with you my storage process paging next time. Please stay tuned!
PS: Tandy tang I wish you a pleasant write of your code!