In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces you how to understand the asp.net paging control, the content is very detailed, interested friends can refer to, hope to be helpful to you.
I. explanation
AspNetPager.dll this paging control is mainly used for asp.net webform websites, and the code will be sorted out as follows
II. Code
1. First add a reference to the test page Default.aspx page
2. Write a Repeater list control to display data
3. Add
The PageSize property is used to set the number of displays per page
4. Background code binding
/ / Test data source
Private void ShowNews () {String strSql = String.Format ("select * from News order by time asc"); DataTable dtbl = Access.ExecuteDataTable (strSql, null); this.rptNews.DataSource = Access.GetPageDataSource (AspNetPager1, AspNetPager1.CurrentPageIndex-1, dtbl); this.rptNews.DataBind ();}
Access is a test database access class, which is provided to you in the final Demo
5. Paging control clicks the page number event
/ / paging protected void AspNetPager1_PageChanging (object src, Wuqi.Webdiyer.PageChangingEventArgs e) {this.AspNetPager1.CurrentPageIndex = e.NewPageIndex; ShowNews ();}
Finally, I send you the whole page of code:
Default.aspx
Asp.net paging control .aboutcontentnr {width:100%; height:auto;}
Default.aspx.cs
Using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Data;public partial class Default: System.Web.UI.Page {protected void Page_Load (object sender, EventArgs e) {if (! IsPostBack) {ShowNews ();}} / / Test data source private void ShowNews () {String strSql = String.Format ("select * from News order by time asc") DataTable dtbl = Access.ExecuteDataTable (strSql, null); this.rptNews.DataSource = Access.GetPageDataSource (AspNetPager1, AspNetPager1.CurrentPageIndex-1, dtbl); this.rptNews.DataBind ();} / / Page Click event protected void AspNetPager1_PageChanging (object src, Wuqi.Webdiyer.PageChangingEventArgs e) {this.AspNetPager1.CurrentPageIndex = e.NewPageIndex; ShowNews ();}}
III. Demo
AspNetPager (dll)
AspNetPage (Demo)
On how to understand the asp.net paging control to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.