Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 474
Omer Firat Avatar asked Dec 23 '12 12:12

Omer Firat


1 Answers

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;
}
like image 169
DmitryG Avatar answered Oct 21 '22 02:10

DmitryG