Use of paging features in DataGrid

xiaoxiao2021-03-06  73

1. Set the AllowPaging property to True and set the size of the PageSize

2, set the property of DataGrid in the HTML page onpageIndexchanged = "datagrid_page" //

// DataGrid_page is an incident that excited when clicking on the number of pages

3. Add code in the program as follows:

public void DataGrid_Page (object sender, DataGridPageChangedEventArgs e) {DataGrid1.CurrentPageIndex = e.NewPageIndex; BindData (); // method to bind data to write BindData also remember to call in Page_Load () method when not to put in if ( IS_POSTBACK) inside! }

4. When you need to call multiple times, every time you initialize the initialization display, you can remember setting up in Page_Load.

DataGrid1.currentpageIndex = 0;

Otherwise, it will default to display the number of pages displayed last time, which may result in errors, because the number of pages displayed this time may not follow the last time.

5, ok

6, if you have some good ideas, PLS Contact to ME!

转载请注明原文地址:https://www.9cbs.com/read-120867.html

New Post(0)