How to put a ReadOnly column?

3

I'm trying to leave only one column of GridView as ReadOnly , I'm doing so:

        if (id_crm == 0)
        {
            textBox2.Text = Convert.ToString(cod_crm());

            DataTable dat_itens = new DataTable();

            dat_itens.Columns.Add("ITEM", typeof(int));
            dat_itens.Columns.Add("DESCRIÇÃO", typeof(string));
            dat_itens.Columns.Add("DESCRIÇÃO NF", typeof(string));
            dat_itens.Columns.Add("QUANTIDADE", typeof(int));
            dat_itens.Columns.Add("OF ORIGEM", typeof(string));

            gridControl1.DataSource = dat_itens;

            gridView5.Columns[0].Width = 28;
            gridView5.Columns[0].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            gridView5.Columns["ITEM"].ReadOnly = true;  

        }

However, it displays an error:

    
asked by anonymous 04.09.2016 / 18:06

1 answer

2

The GridColumn.ReadOnly property is read-only.

To indicate if a column is "editable" or you do not have to do this via the GridColumn.OptionsColumn property like this:

gridView5.Columns["ITEM"].OptionsColumn.ReadOnly = true;
    
04.09.2016 / 18:49