1. Add references 2. Drag and Drop controls on the page 3. <% @ Register assembly = "AspNetPager" namespace = "Wuqi. webdiyer "tagprefix =" webdiyer "%> 4. set basic properties of the Control <webdiyer: aspNetPager ID = "AspNetPager1" runat = "server" FirstPageText = 'homepage' LastPageText = 'tail' margin = "10px" ShowPageIndexBox = "Always" CustomInfoHTML = "% RecordCount % Total, page % CurrentPageIndex %/Total % PageCount % PAGE "NextPageText =" next page "PrevPageText =" Previous Page "ShowCustomInfoSection =" Left "Sub MitButtonText = "Go" align = "page" align = "Go to" UrlPaging = "True" CustomInfoSectionWidth = "20%" CustomInfoTextAlign = "Center" onpagechanged = "aspnetpager#pagechanged"> </webdiyer: aspNetPager> 5. Background Code protected void Page_Load (object sender, EventArgs e) {string sqlStr = "select * from download where 1 = 1"; if (key. text! = "") {SqlStr + = "and title like '%" + key. text + "% 'order by id desc";} else {sqlStr + = "order by id desc";} string s = ConfigurationManager. connectionStrings ["siteconn"]. connectionString; // define the connection string SqlConnection conn = new SqlConnection (s); // create a database connection object, where s is the connection string conn. open (); // Open the connection to the database SqlCommand cmd = new SqlCommand (sqlStr, conn); AspNetPager1.AlwaysShow = true; AspNetPager1.PageSize = 15; AspNetPager1.RecordCount = (int) cmd. executeScalar (); conn. close (); bind ();} private void bind () {string sqlStr = "select * from download where 1 = 1"; if (key. text! = "") {SqlStr + = "and title like '%" + key. text + "% 'order by id desc";} else {sqlStr + = "order by id desc";} string s = ConfigurationManager. connectionStrings ["siteconn"]. connectionString; // define the connection string SqlConnection conn = new SqlConnection (s); // create a database connection object, where s is the connection string conn. open (); // Open the connection with the database DataSet myds = new DataSet (); SqlDataAdapter adapter = new SqlDataAdapter (sqlStr, conn); adapter. fill (myds, AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex-1), AspNetPager1.PageSize, "myds"); GridView1.DataSource = myds. tables ["myds"]; GridView1.DataBind ();} protected void aspnetpager?pagechanged (object sender, EventArgs e) {bind ();} 6. Add sequence number <asp: templateField HeaderText = "no."> <ItemTemplate> <% # (this. aspNetPager1.CurrentPageIndex-1) * this. aspNetPager1.PageSize + Container. dataItemIndex + 1%> </ItemTemplate> </asp: TemplateField>