Practical basic skills (07) -------- view the Gridview tips of the DEV control.
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 ();
How to install the gridview control of a third-party control dev
You can directly install dev. After the installation is complete, this control will automatically be available. They are a set
How to read a field value of the row selected by the gridview control of the third-party control dev?
Gridview. getfoucerowcell ("field name ");