I searched the online for the event execution sequence, and the test results showed that it was incorrect when there were pages.
Event execution sequence:
1. Display bound data in the gridview (5 rows by default ):CopyCodeThe Code is as follows: databinding
Rowcreated: Header [0]
Rowdatabound
Rowcreated: datarow [1]
Rowdatabound
Rowcreated: datarow [2]
Rowdatabound
Rowcreated: datarow [3]
Rowdatabound
Rowcreated: datarow [4]
Rowdatabound
Rowcreated: datarow [5]
Rowdatabound
Rowcreated: footer [6] // This event will occur no matter whether there are any corner lines.
Rowdatabound
Rowcreated: pager [7]
Rowdatabound
Databound
The order is as follows:
Databinding
Rowcreated
Rowdatabound
......
Databound
2. Order of events when the page button is clicked in the gridview:Copy codeThe Code is as follows: rowcommand
Pageindexchanging
Pageindexchanged
Databinding
Rowcreated: Header [8]
Rowdatabound
Rowcreated: datarow [9]
Rowdatabound
Rowcreated: datarow [10]
Rowdatabound
Rowcreated: datarow [11]
Rowdatabound
Rowcreated: datarow [12]
Rowdatabound
Rowcreated: datarow [13]
Rowdatabound
Rowcreated: footer [14]
Rowdatabound
Rowcreated: pager [15]
Rowdatabound
Databound
Understanding: When clicking the page Jump button, only the information of the page to be displayed will be bound. As shown above, no information will be bound to rowdatabound, only the total number of pages on the current page can be counted (as shown in the preceding 9-13 documents)
For now, we only need to make statistics on the information to be bound. Cannot be processed in the event in the gridview.