无法禁用UltraGrid单元 [英] Cannot disable UltraGrid cells

查看:98
本文介绍了无法禁用UltraGrid单元的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目中有一个UltraGrid.可以将数据输入到每个单元格中,然后将其保存到数据库中.我希望能够禁用当前行中除Product_Code之外的所有所有单元格.一旦将数据输入到活动行列中(通过ValueList输入),我便希望所有其他单元格都可用于向其中输入数据.

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?

推荐答案

由于某种原因,我之前看到的关于此内容的评论已被删除.但是,您可以尝试的一种解决方法是:

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

  • 以表格形式加载;添加ugProducts.DisplayLayout.Override.CellClickAction = CellClickAction.CellSelect-这意味着所有单元格都被禁用,但是您仍然可以为Product_Code
  • 选择ValueList
  • 现在,在ugProductsCellListSelect事件中,使用以下代码ugProducts.DisplayLayout.Override.CellClickAction = CellClickAction.Edit(在进行任何验证检查或该方法中已有的任何内容之后,它将进入此处的某个位置,如果出现以下情况,请继续尝试一下)您不太确定在哪里)
  • 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.

这篇关于无法禁用UltraGrid单元的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆