Can I make row cell value readOnly on XtraGrid just for one row?

Omer Firat picture Omer Firat · Dec 23, 2012 · Viewed 11.8k times · Source

How can I make a specific row cell readonly(not editable) on XtraGrid? For example just for row[0] but not all rows.

Answer

DmitryG picture DmitryG · Dec 24, 2012

You can use the GridView.CustomRowCellEdit event:

//...
var repositoryItemTextEditReadOnly = new DevExpress.XtraEditors.Repository.RepositoryItemTextEdit();
repositoryItemTextEditReadOnly.Name = "repositoryItemTextEditReadOnly";
repositoryItemTextEditReadOnly.ReadOnly = true;
//...
void gridView1_CustomRowCellEdit(object sender, CustomRowCellEditEventArgs e) {
    if(e.RowHandle == 0)
        e.RepositoryItem = repositoryItemTextEditReadOnly;
}