Xtragrid one column editable other aren't

10,315

Solution 1

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; }
}

Solution 2

@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

Share:
10,315
user2901896
Author by

user2901896

Updated on June 05, 2022

Comments

  • user2901896
    user2901896 almost 2 years

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