简体   繁体   English

在Infragistics UltraGrid中启用和禁用列

[英]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. 我有一个Infragistics网格,我想根据一些要求禁用和启用一些列。 I have read some articles that say to use AllowUpdate = DefaultableBoolean.True but it did not work for me. 我已经阅读了一些文章,说使用AllowUpdate = DefaultableBoolean.True但它对我不起作用。

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# 你也没有指定语言,所以我会使用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 . CellActivation属性也可以设置为Activation.DisabledActivation.ActivateOnly
The property CellClickAction allows to set an appropriate selection status for the cell clicked. CellClickAction属性允许为单击的单元格设置适当的选择状态。 You could use CellSelect or RowSelect . 您可以使用CellSelectRowSelect (This last one, to mimic the behavior of a ListBox) (最后一个,模仿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. 然后Intellisense将为您提供这些值的含义的快速和公平的解释。

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;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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