Search code examples
devexpressdevexpress-wpf

How can i make a grid column cell to read only in Dev-Express?


I need to make a Grid Cell to be read only If my condition is false. In devexpress gridControl.


Solution

  • try this and change condition as per requirement

    protected void ASPxGridView1_CellEditorInitialize(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewEditorEventArgs e) {
        if (ASPxGridView1.IsNewRowEditing) return;
        if (e.Column.FieldName == "UnitPrice")
                 if (ASPxGridView1.GetRowValues(....) == ....)
                       e.Editor.ReadOnly = true;
    }