1. Line command processing
(1. BackgroundCode: Operation line
// If this function operation is from the HTML response
If (E. commandname = "addage "){
// Obtain the row number
Int Index = (listviewdataitem) E. Item) dispalyindex;
// Obtain the primary key value of the current operation row
// Datakeys stores all IDs and obtains the index ID.
Guid id = (guid) listview1.datakeys [Index]. value;
Table adapter = new table adapter ();
Adpter. User-Defined database function addage;
// Data Binding
Listview. databing ();
}
(2) sorting
Commandname = "sort"
Commandargument = "ID"
Internal sorting with Low Efficiency
2. datapager page
Pagecontrolid: To which listview is displayed
Advanced paging:
Query subqueries
Select * from
(Select ID, name, age, row_number () over (order by ID) rownum from t_users) T
Where T. rownum> 11and T. rownum <20
3. Efficient paging:
(1. Database methods:
// Obtain the number of rows on the current page
Start row: startrowindex
Start to add the number of rows on this page: startrowindex + maximumrows
// Database method: getcount
Select count (*) from t_users
// Database method name: querycount
Select * from
(
Select ID, name, gender, row_number () over (order by ID) rownum from DBO. t_user
) T
Where T. rownum> @ startrowindex and T. rowrow <= @ startrowindex + @ maximumrows
Because the startrowindex + maximumrows parameters are not generated for us, we need to manually add them.
(2) Page
** Do not <selectparameters>
** Added a selectcountmethod = "querycount" method to set the number of rows to be retrieved.
Selectmethod = "getpagedata" is used to obtain paging information.
And enablepaging = "true"
** First configure the objectdatasource of the listview according to the normal process, so that the listview will automatically generate
Configure the paging data source again