1 usingSystem;2 usingSystem.Collections.Generic;3 usingSystem.Linq;4 usingsystem.web;5 usingSystem.Web.UI;6 usingSystem.Web.UI.WebControls;7 8 namespaceWebApp9 {Ten Public Partial classDataListWeb:System.Web.UI.Page One { A -Bll. MANAGERBLL BLL =NewBLL. MANAGERBLL (); - protected voidPage_Load (Objectsender, EventArgs e) the { - if(!IsPostBack) - { - getdatasouse (); + } - } + Public intgetrequest A { at Get - { - if(request.querystring["P"] !=NULL) - { - returnConvert.ToInt32 (request.querystring["P"]); - } in Else return 1; - } to } + Public voidGetdatasouse () - { thePagedDataSource PDS =NewPagedDataSource (); *Pds. DataSource =Bll.getall (); $Pds. AllowPaging =true;Panax NotoginsengPds. PageSize =2; -Pds. CurrentPageIndex = Getrequest-1; theDatalist1.datasource =PDS; + DataBind (); A the Initcontrol (Getrequest, PDS. PageCount); + - } $ /// <summary> $ /// - /// </summary> - /// <param name= "Pagenow" >Current Page</param> the /// <param name= "PageCount" >Total Pages</param> - Public voidInitcontrol (intPagenow,intPageCount)Wuyi { the This. Hlkfrist.navigateurl = String.Format ("datalistweb.aspx?p={0}",1); - This. Hlkfoot.navigateurl = String.Format ("datalistweb.aspx?p={0}", PageCount); Wu This. Hlktop.navigateurl = String.Format ("datalistweb.aspx?p={0}", Pagenow-1>0? Pagenow-1:1); - This. Hlknext.navigateurl = String.Format ("datalistweb.aspx?p={0}", Pagenow +1> PageCount? Pagenow +1: PageCount); About $}