简体   繁体   中英

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.

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.

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM