Let Datalist can also page

xiaoxiao2021-03-06  81

As we all know, I will provide us with three data controls - DataGrid, Repeater, DataList. In these three controls, the DataGrid control is the most powerful, and the Repeater control is the most loyal to the template. The DataList control is both.

The DataGrid control is too famous, so there is also a lot of talks before, and the Repeater is too small, there is nothing to say. Here is mainly to talk about the DataList control.

The DataList control is also very powerful. He supports the choice, editing, and implementation. It is also very simple. ! !

It is indeed a very distressed thing.

However, DataList does not provide built-in paging function, but do not say, we can't use the DataList control to implement pagination, since it does not give me a paging function, then I have to do it.

Below is all original code, the method used by the method and the paging in the PHP are similar, just use the DataAdapter and DataSet combination, not the SQL statement in the PHP.

<% @ Page language = "c #"%>

<% @ Import namespace = "system.data"%>

<% @ Import namespace = "system.data.oledb"%>