3
I’m trying to leave only one column of GridView
as ReadOnly
, I’m doing like this:
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:
thank you very much. it worked perfectly, can you give me a brief explanation about what would be a read-only property? Thank you very much.
– Thomas Erich Pimentel
A read-only property cannot be changed, it is only possible to get its value. It is declared as follows
public tipo Nome {get;}
– ramaral
I’m not sure, but I think that only applies to Devexpress Gridview’s.
– Jéf Bueno
@jbueno Yes, the question refers to Devexpress Gridview’s.
– ramaral