Of course, first you have to put the bin file into your project, and add to your toolbar to
The page header needs to be referenced by the
<%@ Register assembly= "Aspnetpager" namespace= "Wuqi.webdiyer" tagprefix= "Webdiyer"%>
Control Section (format is already well designed)
<webdiyer:aspnetpager id= "AspNetPager1" runat= "alwaysshow=" True "firstpagetext=" < Font face= ' webdings ' >9</font> '
lastpagetext= ' <font face= ' webdings ' >:</font> ' nextpagetext= "<font face= ' webdings ' >8</font>" prevpagetext= "<font face= ' webdings ' >7</
Font> "showcustominfosection=" left "inputboxstyle=" width:19px "
textafterinputbox=" page "textbeforeinputbox=" Go to the "custominfohtml=" to retrieve the <strong>%RecordCount%</strong> Records page times: <strong>%currentpageindex%/% Pagecount%</strong> per page <strong>%PageSize%</strong> "
horizontalalign=" "Right" width= "100%" showinputbox= "Always" onpagechanged= "aspnetpager1_pagechanged"
pagesize= "1" >
</webdiyer:AspNetPager>
background-bound Code
void DataBind ()
{
int qyid = Convert.ToInt32 (request.cookies["Compenyuser"). Value);//Enterprise's id
DataTable dt = BLL. Viewlist (Qyid);
This. Aspnetpager1.recordcount = dt. rows.count;//get the total number of data
pageddatasource PDS = new PagedDataSource ();
Pds. DataSource = dt. defaultview;//binds the data PDS to the control
. AllowPaging = true;//To enable PDS for paging
. PageSize = aspnetpager1.pagesize;//Gets the quantity PDS per page display
. CurrentPageIndex = aspnetpager1.currentpageindex-1;
Repeater1.datasource = PDS;
Repeater1.databind ();
}
Pagination, just put the binding in the Aspnetpager1_pagechanged event
And give you an example
Front page code
<%@ Page language= "C #" autoeventwireup= "true" codefile= "TF_Product.aspx.cs" inherits= "tf_product"%> <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <%@ Register assembly=" Aspnetpager "namespace=" Wuqi.webdiyer "tagprefix=" Webdiyer "%>"
Background code
Tb_productshelper helper = new Tb_productshelper ();
ilist<tb_productsinfo> list = helper. Getalllistbysql (product_sql);
This. Aspnetpager1.recordcount = list. Total number of count;//bindings this
. Aspnetpager1.alwaysshow = true;
First declare a page-class object
pageddatasource PS = new PagedDataSource ();
Ps. AllowPaging = true;
Ps. PageSize = this. Aspnetpager1.pagesize;
Ps. CurrentPageIndex = this. aspnetpager1.currentpageindex-1;
Ps. DataSource = list;
This.rp.DataSource = PS;
This.rp.DataBind ();