1. Set a column in the gridview control to be uneditable.
This. griddata. gridview1.columns ["change_date"]. optionscolumn. allowedit = false;
Field: change_date is a field in the database and is bound to the gridview.
2. Set the gridview control to make it uneditable.
This. griddata. isenableedit = false;
3. Set the gridview control and the column headers cannot be sorted.
This. griddatadetail. gridview1.optionscustomization. allowsort = false;
4. Make the gridview Control lose the selected focus
This. griddata. gridview1.focusedrowhandle =-1
5. Check whether data is selected in the gridview.
Int Index = This. griddata. gridview1.getfocused#cerowindex ();
If the index is smaller than 0, it indicates that no row is selected. Otherwise, the row data is selected.
6. Obtain the row data of the selected gridview
Datarow vcurrenrow = This. griddata. gridview1.getfocuseddatarow ();
7. Delete the selected row of data in the gridview.
This. griddatadetail. gridview1.deleterow (this. griddatadetail. gridview1.focusedrowhandle );
8. Add an edit row in the gridview.
Datarow vdetailrow = This. datadetailsourcetable. Rows. Add (); // This is a new row.
Vdetailrow ["primary_key"] = ""; primary_key is the field bound to the gridview by the database, which can be assigned a value later.
9. obtain all the selected row numbers in the gridview.
Int [] irowid = This. griddata. gridview1.getselectedrows ();