The combination of repeater and PageDataSource is used in asp.net to implement paging code
PagedDataSource objPage = new PagedDataSource(); DataView dv = bllBook.GetListByState("", true); // Set data source objPage.DataSource =dv ; // Allow paging objPage.AllowPaging = true; // Sets the number of items to be displayed per page objPage.PageSize = 10; // Define variables to hold the current page index int CurPage; int RecordCount; int PageCount = objPage.PageCount; RecordCount = dv.Count; // Determines if there is a request for a page jump if (Request.QueryString["Page"] != null) { CurPage = Convert.ToInt32(Request.QueryString["Page"]); } else { CurPage = 1; } // Sets the index of the current page objPage.CurrentPageIndex = CurPage - 1; // Display status information lblCurPage.Text = " The first " + CurPage.ToString() + "/" + PageCount.ToString() + " page A total of " + RecordCount.ToString() + " record "; // If the current page is not the home page if (!objPage.IsFirstPage) // define " on 1 page " hyperlinked URL Is: the virtual path of the current execution page , And pass the 1 The index value of the page { lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1); lnkFirst.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(1); } // If the current page is not the last 1 page if (!objPage.IsLastPage) // define " Under the 1 page " hyperlinked URL Is: the virtual path of the current execution page , And pass the 1 The index value of the page { lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1); lnkLast.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(PageCount); } // Data binding Repeater1.DataSource = objPage; Repeater1.DataBind();