Get Cell Control of GridView in DevExpress

14,144

Solution 1

you can make the editor read only by handling CustomRowCellEdit:

private void gridView1_CustomRowCellEdit(object sender, CustomRowCellEditEventArgs e)
{
    if(code goes here)
        e.RepositoryItem.ReadOnly = true;
}

you can also prevent the editor from being show by handling ShowingEditor:

private void gridView1_ShowingEditor(object sender, CancelEventArgs e)
{
    if (code goes here)
        e.Cancel = true;
}

Solution 2

I have found a solution to the problem.

gridView1.CustomRowCellEditForEditing += OnCustomRowCellEditForEditing;

private void OnCustomRowCellEditForEditing(object sender, CustomRowCellEditEventArgs e)
{
    if (e.Column.FieldName != "MyFieldName") return;
        *code here*
        e.RepositoryItem.ReadOnly = true;
}
Share:
14,144
Hans Espen
Author by

Hans Espen

.Net developer

Updated on June 15, 2022

Comments

  • Hans Espen
    Hans Espen almost 2 years

    I have a GridView that has a column with RepositoryItemCheckEdit as ColumnEdit. I want to disable this control for just one row. How can I do this? Any suggestions?