Asp.net provides three powerful list controls: DataGrid, datalist, and repeater. However, only the DataGrid Control provides the paging function. Compared with the DataGrid, datalist and repeater controls have higher style customization. Therefore, we prefer to use datalist or repeater controls to display data. Datalist or repeater controls can be displayed on several pages: 1. Write a method or stored procedure and return the data table (datatable) to be displayed based on the number of incoming pages. 2. Use pageddatasource. Article This section describes how to use the pageddatasource class to display datalist and repeater controls by page. The pageddatasource class is also used inside the DataGrid Control. The pageddatasource class encapsulates the properties of the DataGrid control. These properties enable the DataGrid to execute pagination. Some common attributes of the pageddatasource class: allowcustompaging gets or sets the value indicating whether to enable custom pagination. Allowpaging gets or sets the value indicating whether to enable pagination. Count to obtain the number of items to be used from the data source. Currentpageindex gets or sets the index of the current page. Datasource obtains or sets the data source. Cececount gets the number of items in the data source. Firstindexinpage gets the first index on the page. Iscustompagingenabled gets a value indicating whether to enable custom paging. Isfirstpage gets a value indicating whether the current page is a homepage. Islastpage gets a value indicating whether the current page is the last page. Ispagingenabled gets a value indicating whether to enable paging. Isreadonly gets a value indicating whether the data source is read-only. Issynchronized gets a value indicating whether to synchronize access to the data source (thread safety ). Pagecount obtains the total number of pages required for all items in the data source. Pagesize gets or sets the number of items to be displayed on a single page. Virtualcount gets or sets the actual number of items in the data source when custom pages are used. Are these attributes similar to those of the DataGrid? Yes, the DataGrid control uses the pageddatasource class to display data by page. The following example shows how to use the pageddatasource class to display datalist and repeater controls by PAGE: Public void page_load (Object SRC, eventargs e) {oledbconnection objconn = new oledbconnection (@ "provider = Microsoft. jet. oledb.4.0; Data Source = c: \ test. mdb "); oledbdataadapter objcommand = new oledbdataadapter (" select * from users ", objconn); dataset DS = new dataset (); objcommand. fill (DS); // assign a value to the relevant attributes of the pageddatasource object. Tasource (); objpds. datasource = Ds. tables [0]. defaultview; objpps. allowpaging = true; objpds. pagesize = 5; int curpage; // the current page retrieves if (request. querystring ["page"]! = NULL) curpage = convert. toint32 (request. querystring ["page"]); else curpage = 1; objpds. currentpageindex = CurPage-1; lblcurrentpage. TEXT = "Page:" + curpage. tostring (); If (! Objpps. isfirstpage) lnkprev. navigateurl = request. currentexecutionfilepath + "? Page = "+ convert. tostring (CurPage-1); If (! Objpps. islastpage) lnknext. navigateurl = request. currentexecutionfilepath + "? Page = "+ convert. tostring (curpage + 1); // assign the pageddatasource object to the Repeater control repeater1.datasource = objtp; repeater1.databind ();}. In this way, you can easily display datalist and repeater controls on pages. However, the disadvantage of this operation is that the data on all pages should be selected each time, and the DataGrid should be the same, which will reduce the efficiency (most of the time there is no difference ); if you use the first method, you can select only the data on the current page. (For the implementation method, see the relevant article)