I have a devexpress grid control with the columns "Name", "Class" ,"Marks","Grade". Now part of the data in the grid control is loaded by querying a database table StudentMarks. The remaining part of the data is manually entered into the grid control by setting the Iseditable property of the respective columns. I want a functionality such that the entries which are loaded by querying the database are non-editable, however empty/blank rows in the grid control can be editable. Currently I cannot achieve this since my IsEditable is set to true for all columns in my xaml. Is it possible to specify the editable property at a row granularity rather than column?
0
votes
1 Answers
0
votes
Yes you could make a cell readonly or editable using the gridview_ShowingEditor event, Set editable to true for all columns and handle which cell has to be readonly in this event.
private void gridView1_ShowingEditor(object sender, System.ComponentModel.CancelEventArgs e) {
GridView view = sender as GridView;
if(view.FocusedColumn.FieldName == "Name" || view.FocusedColumn.FieldName == "Class"
|| !newRow(view, view.FocusedRowHandle))
e.Cancel = true;
}