Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enabling and disabling of columns in Infragistics UltraGrid

I have an Infragistics grid and I want to disable and enable some columns based upon some requirement. I have read some articles that say to use AllowUpdate = DefaultableBoolean.True but it did not work for me.

like image 458
user1567194 Avatar asked Aug 03 '12 19:08

user1567194


2 Answers

I suppose that when you talk of disabled columns you mean disable editing in these columns. Also you don't specify the language, so I will use C#

UltraGridColumn c = grdWork.DisplayLayout.Bands[0].Columns["YourColumnName"];
c.CellActivation = Activation.NoEdit; 
c.CellClickAction = CellClickAction.CellSelect;

The property CellActivation could also be set to Activation.Disabled or Activation.ActivateOnly.
The property CellClickAction allows to set an appropriate selection status for the cell clicked. You could use CellSelect or RowSelect. (This last one, to mimic the behavior of a ListBox)
As usual, the real difficulty is to find the correct property. Then Intellisense will give you a quick and fair explanation of the meaning of these values.

like image 173
Steve Avatar answered Oct 31 '22 16:10

Steve


If you just want to show and hide the columns as needed then you can try the following.

UltraGrid myGrid = new UltraGrid();
//Bind to your data here
myGrid.DisplayLayout.Bands[0].Columns["ColumnName"].Hidden = true;
like image 31
Subba Rao Avatar answered Oct 31 '22 15:10

Subba Rao