Use of paging features in DataGrid

xiaoxiao2021-03-06  103

Author: Muzi http://blog.9cbs.net/derny/1, the AllowPaging property is set to true and set the size of 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.

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

New Post(0)