It is sometimes necessary to make a column which is editable in the underlying data read-only or disabled in the grid. This can be done by changing the Activation on several levels of objects.
To disable editing in the entire grid or on a Band-level, use the AllowUpdate property on the override. There is an Override property on the grid's DisplayLayout and on the band, so you can disable editing on the entire grid via the DisplayLayout.Override and then override the DisplayLayout setting on any individual band.
// Disable updating on the entire grid this.ultraGrid1.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.False; // Enable updating on the root band. This will override the displayLayout setting this.ultraGrid1.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;
' Disable updating on the entire grid Me.ultraGrid1.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.False ' Enable updating on the root band. This will override the DisplayLayout setting Me.ultraGrid1.DisplayLayout.Bands(0).Override.AllowUpdate = DefaultableBoolean.False
To affect an entire column, use the CellActivation Property on the column.
// Disable the first column in the first band this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].CellActivation = Activation.Disabled;
' Disable the first column in the first band Me.ultraGrid1.DisplayLayout.Bands(0).Columns(0).CellActivation = Activation.Disabled
To affect an entire row, use the Activation property of the row.
// Disable the first row in the grid this.ultraGrid1.Rows[0].Activation = Activation.Disabled;
' Disable the first row in the grid Me.ultraGrid1.Rows(0).Activation = Activation.Disabled
To affect individual Cells, set the Activation property on the Cell.
// Disable the first cell in the grid this.ultraGrid1.Rows[0].Cells[0].Activation = Activation.Disabled;
' Disable the first cell in the grid Me.ultraGrid1.Rows(0).Cells(0).Activation = Activation.Disabled
When using CellActivation or Activation, a Cell will always take on the least accesible Activation level based on it's Row, Column, and Cell Settings. For example, if the Row is Disabled, the Activation settings of the Column and Cell will be ignored. If it is necessary to allow editing in a single Cell whose column or row is otherwise disabled or Read-only, the cell can be forced to honor it's own Activation Property by setting the IgnoreRowColActivation property on the cell to true.
Note that updating and deleting are separate properties. To prevent rows from being deleted, use the AllowDelete property on the override.
// Disable deleting on the entire grid this.ultraGrid1.DisplayLayout.Override.AllowDelete = DefaultableBoolean.False; // Enable deleting on the root band. This will override the displayLayout setting this.ultraGrid1.DisplayLayout.Bands[0].Override.AllowDelete = DefaultableBoolean.False;
' Disable deleting on the entire grid this.ultraGrid1.DisplayLayout.Override.AllowDelete = DefaultableBoolean.False ' Enable deleting on the root band. This will override the DisplayLayout setting Me.ultraGrid1.DisplayLayout.Bands(0).Override.AllowDelete = DefaultableBoolean.False