DEV express assigns a value to the element of a row in the Gridview, devgridview
1: Get the value of a column in the selected row
String colValue = this. gridView1.GetRowCellValue (this. gridView1.FocusedRowHandle, this. gridView1.Columns [1]). ToString ();
Gridview. GetFocusedRowCellValue ("field value ")
Dev gridview tips
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 ();
To convert a model object, you can operate on each line of document data separately.
ModelClass Model = vCurrenRow as ModelClass;
Model. aa = "cc ";
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 ();