Step 1: display the checkbox button;
Click columns in aspxgridview. You can directly add a command column line or select one option and then click Change to commadn column. The default showselectcheckbox is true, so we don't need to worry about it, in this way, you can see that each row has a checkbox button.
Step 2: check box is displayed in the table header and click "Select All". | select inverse;
Switch backSource code, Locate the gridviewcommandcolumn of aspxgridview, and add
Add a Dev checkbox button in headertemplate and set its style to horizontalalign = "center, we added a function (s, e) {dgvwemail to the checkbox button clientsideevents-checkedchanged. selectallrowsonpage (S. getchecked () ;}, dgvwemail is the ID of your aspxgridview control. At this point, you can select all the table headers | invert selection is enabled;
Step 3: Obtain the ID of the selected row for batch deletion or modification;
Add a Dev button to the page and add a click event to the button;
First, we write a method to obtain the IDs of all selected rows.
Protected string getdelid () {string delid = "";
// Obtain the selected record ID list <Object> lselectvalues = dgvwemail. getselectedfieldvalues ("ID ");
For (INT I = 0; I <lselectvalues. Count; I ++) {delid + = lselectvalues [I] + ",";}
Delid = delid. substring (0, delid. lastindexof (','));
Return delid ;}
This method obtains the ID of the selected row, obtains the id Primary Key of the bound data through aspxgridview. getselectedfieldvalues ("ID"), and then traverses the obtained ID;
The next step is the same as writing all the other options for deletion. You can try to write them.