Code in the Default.aspx.cs
protected int pageIndex = 1;
protected int pageSize = ten;
protected int pagecount = m;
Protected string name = String. Empty;
protected void Page_Load (object sender, EventArgs e)
{
int. TryParse (request.querystring["PageIndex"],out pageIndex);
name=request.querystring["name"];
Code in the Default.aspx.cs
The contents of the body
Name: <input type= "text" id= "txtname" value= "<%=name%>" "/> <div id=" Pagebar "
>
The content of JS
<script src= "Jquery-1.4.1.js" type= "Text/javascript" ></script> <script type= "Text/javascript" >
var pagecount=<%=pagecount%>;
var pageindex=<%=pageindex%>;
var pagesize=<%=pagesize%>;
$ (function () {Createpagebar (pageindex,pagecount);
)//Raw ingredient page Bar function Createpagebar (pageindex,pagecount) {//Get the div that holds the pagination and empty the Var pagebarobj=$ (' #PageBar ');
Pagebarobj.html (");
Determines the given page number if (pageindex<1) {pageindex=1;
} if (Pageindex>pagecount) {pageindex=pagecount; //home page with previous $ (' <a href= "javascript:void (0)" > Home </a> '). Appendto (Pagebarobj). Click (function () {Gopage
(1);
});
if (pageindex>1) {$ (' <a href= ' javascript:void (0) ' > Prev </a> '). Appendto (Pagebarobj). Click (function () {
Gopage (pageindex-1);
});
}//Digital paging var start=pageindex-4;
if (start<1) {start=1;
} var end=start+9;
if (end>pagecount) {end=pagecount; }
for (Var i=start;i<=end;i++) {$ (' <a href= "javascript:void (0)" >[' +i+ "]</a> '). Appendto (Pagebarobj).
Click (function () {gopage (i);
}); //Next and last if (Pageindex<pagecount) {$ (' <a href= ' javascript:void (0) ' > next page </a> '). Appendto (Pagebar
OBJ). Click (function () {gopage (pageindex+1);
});
} $ (' <a href= ' javascript:void (0) ' > Last </a> '). Appendto (Pagebarobj). Click (function () {gopage (PageCount);
});
//GO Jump function Gopage (pageindex) {var name=$ (' #txtName '). Val ();
window.location= "/default.aspx?pageindex=" +pageindex+ "&name=" +name; } </script>
The above asp.net of the JS-content page of the method is small to share the whole of the contents of everyone, I hope to give you a reference, but also hope that we support the cloud-dwelling community.