'First column of GridView readonly unless new row

I have a GridView with various columns and rows pulled from a database.

In the first column I have a dateEdit repository item.

What I would like to do is have this first column readonly for all rows except when the user clicks "Add new row" as the user will need to edit the date on new rows.

I have been trying using the ShowingEditor() event and e.Cancel however this makes the whole row readonly and not just the first column (the rows have other repository items like TextEdits).

I am using DevExpress with Visual Basic and Visual Studio 2019.



Solution 1:[1]

In ShowingEditor event you can use FocusedColumn property to set e.Cancel = True only for particular columns.

If YourGridView.FocusedColumn.FieldName = "YourDateEditColumn" Then
    e.Cancel = True
    Exit Sub
End If

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 tezzo