动态更改 ASPxGridView 的编辑器类型
我有一个来自 DevExpress 的 ASPxGridView,其中包含来自 ObjectDataSource 的数据。我的数据行对象公开 ParameterName、ParameterType 和 ParameterValue 等属性。
//Properties, constructor and private fields code omitted for clarity
public class InputParameterDescription
{
public string ParameterName;
public Type ParameterType;
public int ParameterPrecision;
public string ParameterDescription;
}
ParameterValue 始终是 ParameterType 属性指示的类型的对象。事实上,我使用了几种类型——Int32、Double、String 或 Boolean。当我在网格中显示值并且用户单击“编辑”时,始终使用文本框编辑 ParameterValue。是否可以根据 ParameterType 更改此列的编辑器?我希望我的用户使用 SpinEdit 处理整数,使用复选框处理布尔值等。
事实上,这就是人们使用 DevExpress Delphi 网格的方式 - TdxGrid 和 TcxGrid(OnGetProperties 事件)。我在 DevExpress 论坛上问过这个问题,但没有得到任何答案:(
I have an ASPxGridView from DevExpress fed with data from ObjectDataSource. My data row objects expose properties such ParameterName, ParameterType and ParameterValue.
//Properties, constructor and private fields code omitted for clarity
public class InputParameterDescription
{
public string ParameterName;
public Type ParameterType;
public int ParameterPrecision;
public string ParameterDescription;
}
ParameterValue is always an object of type indicated by ParameterType property. In fact, I use few types – Int32, Double, String or Boolean. When I display values in a grid and user clicks “Edit” a ParameterValue is always edited with TextBox. Is it possible to change editor for this column according to ParameterType? I want my users to use SpinEdit for integers, checkbox for Boolean, etc.
In fact, this is the way people have been working with DevExpress Delphi grids - TdxGrid and TcxGrid (OnGetProperties event). I have asked this question in DevExpress forum, but haven’t got any answer :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在该列上创建一个模板来为您进行切换。类似于:
然后您只需将此模板指定为该列的 EditItemTemplate:
You could create a template on that column that would do the switch for you. Something like:
Then you just need to specify this template as the EditItemTemplate of the column: