Cannot disable UltraGrid cells

混江龙づ霸主 提交于 2019-12-25 07:50:07

问题


I have an UltraGrid in my project. Data can be entered into each cell, which is then saved to the database. I want to be able to disable all of the cells in the current row EXCEPT for one called Product_Code. Once data has been entered into the active row column (this is entered via a ValueList), I then want all of the other cells to become available for entering data into.

So far I have tried

If Me.ugProducts.ActiveRow.Cells("Product_Code").Value.ToString = "" Then
    Me.ugProducts.ActiveRow.Cells("Product_Volume").Activation = Activation.Disabled
Else
    Me.ugProducts.ActiveRow.Cells("Product_Volume").Activation = Activation.AllowEdit
End If

But to no success. When the project is built, all of the cells are immediately available to type into, despite no value having been entered.

Why is it not working? What is the best way to do this?


回答1:


I saw a previous comment on here that has since been deleted, for some reason... However, one solve you can try is:

  • In the form load; add in ugProducts.DisplayLayout.Override.CellClickAction = CellClickAction.CellSelect - This will mean all of the cells are disabled, but you'll still be able to select the ValueList for Product_Code
  • Now, in the CellListSelect event of ugProducts, use the following code ugProducts.DisplayLayout.Override.CellClickAction = CellClickAction.Edit (After any validation checks or anything that you have in the method already, it will go in here somewhere, just keep trying things if you aren't too sure where)

Anyway, this should now let you fill them in as you wish.



来源:https://stackoverflow.com/questions/39102502/cannot-disable-ultragrid-cells

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!