Asp. Net Data Control Reference AspNetPager. dll paging implementation code

Source: Internet
Author: User

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
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: In the code section, I use the Repeater control as an example. Other data controls, such as GridView and Datalist, are used in the same way...

Front-end code:Copy codeThe Code is as follows: <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 = ""
TextBeforePageIndexBox = "go to" Font-Size = "14px" CustomInfoHTML = "Total <font color = '# ff0000'> % PageCount % </font> page, page <font color = '# ff0000'> % CurrentPageIndex % </font>"
ShowCustomInfoSection = "Left" CustomInfoSectionWidth = "19%"
PagingButtonSpacing = "3px" onpagechanged = "aspnetpager?pagechanged">
</Webdiyer: AspNetPager>

Background code:Copy codeThe Code is as follows: private void DatasBind ()
{
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 void AspNetPager1_PageChanged (object sender, EventArgs e)
{
DatasBind ();
}

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!

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.