3

Hi I have DevExpress xtragrid control. How can I set just for one column editable = true (column is empty)

user2901896
  • 31
  • 1
  • 2
  • 4

3 Answers3

3

Use the GridColumn.OptionsColumn.AllowEdit property:

// sample data
gridControl1.DataSource = new List<DataObj> { 
    new DataObj(){ Agent = "AMD" },
    new DataObj(){ Agent = "!!!AMD" },
};
//...
gridView1.PopulateColumns();
foreach(GridColumn column in gridView1.Columns) // disable editing for all columns
    column.OptionsColumn.AllowEdit = false;
gridView1.Columns["Description"].OptionsColumn.AllowEdit = true; // enable editing for specific column
//...
class DataObj {
    public string Agent { get; set; }
    public string Description { get; set; }
}
DmitryG
  • 17,677
  • 1
  • 30
  • 53
3

@DmitryG 's answer is right if you need to work with all columns automatically and from code.

If you want to change it not from code(code will be added to *designer.cs file): go to xtragrid's designer->columns columns there for every column you want to be not editable choose column options and choose "true" for readonly or "false" allow edit. visual editor

http://documentation.devexpress.com/#WindowsForms/CustomDocument807

0x49D1
  • 8,505
  • 11
  • 76
  • 127
0

Your question is a bit vague, if you want to set as column to be readonly dothe following;

YourcolName.OptionsColumn.AllowEdit = false;

If your columns aren't editable, it is your datasource that is the problem, it could be the list implementation. or the object holding your row data, or you a re trying to update a unbound row?

You'll will have to provide more info for us to give you any answers...

Stig
  • 1,323
  • 16
  • 22