Release Date: 8/30/2005 Update Date: 8/30/2005
Panqi UltraPower Software
Introduction: Using DOTNET development WAP applications, usually encountering problems in the DOTNET, although Itemcount and ItemsPage properties are provided in the DOTNET List control, this comrainable flipping can only implement "Previous Page" "The" next page "will not be selectively paged by the number of pages, so it is necessary to develop its own page pages, to improve its shortcomings, this document describes how to use it step by step .NET provides limited mobileControl to implement page number by specifying page.
If you have to pay, please keep the original and don't make a delete. Thank you.
Source code download >>
Scenary 1: Method for implementing page pages using data binding, specifying data sources
The first step, open VS.NET, create a new ASP.NET mobile web application, and we are named Wappager here, as shown below:
Step 2, drag into the desired control to the Form:
Label control, one, used to display the prompt message.
List control, one, used to bind data, display records within the specified range.
The Panel control, one, the LINK page number for storing the N page calculated by the expression.
The page layout is shown below:
In the third step, modify the control attribute, prepare for the encoding (see Demo, see Demo).
Step 4, encoding. (Description: Demo data from the Northwind database from SQL-Server)
In order to realize the pages, the following three methods are required, respectively:
1, getAllData () method:
GetAllData is a way to get all data, returns a DataTable method, which is used to store all data, mainly to get recorded in the specified range by later use DataTable SELECT methods;
Private DataTable getAllData () {this.sqldataadapter1.fill (this.DataSet11); return this.dataset11.tables ["products"];
2, getpage () method:
GetPage is the total number of data, each page specifies the number of display, calculating the number of pages, returns the DATATABLE stores all the page number, and we define two columns of linktext and linkurl for this data, these two columns are supplied to the Tablet control LINK binding data. Used.
private DataTable GetPage () {DataTable dtPage = new DataTable (); DataTable dtAllData = this._dtAllData; int dataCount = dtAllData.Rows.Count; int pageCount = 0; if ((dataCount% GlobalConfig.Size) == 0) {pageCount = Datacount / GlobalConfig.size;}}} ((Datcount% globalconfig.size)! = 0) {pagecount = Datacount / GlobalConfig.size 1;} dtpage.columns.add ("linktext", typeof (string); dtpage .Columns.add ("linkurl", typeof (string); for (int i = 0; i
For (int i = 0; i Note: The maximum number of records can be displayed at the top of Web.config's GlobalSecion property runce. If you have any comments or suggestions, please contact the author: Email: PanQi7000 (a) 126.com, please (a) Replace @. Write by myxq