如何在datagrid中获取单元格值 [英] How do I get cell value in datagrid
问题描述
我在灯光开关中选择了可编辑网格屏幕,
在此网格中我有4个字段名称,描述,createdbyuser,ModifiedByuser
createdbyuser需要设置为当前用户名。在数据网格中如何为该单元格赋值。
只有在修改或编辑记录时才需要设置ModifiedByuser。
我已经设置了身份验证,我可以通过application.user.name
获取当前用户名,但是如何将它们分配给网格中的单元格。
非常感谢你的帮助。
谢谢,
I Selected Editable Grid Screen in Light switch,
In this grid I have 4 fields Name, Description, createdbyuser,ModifiedByuser
createdbyuser needs to be set as current username. In a datagrid how do I assign value to that cell.
ModifiedByuser is need to be set only when modifying or editing the record.
I have set authentication on and I can get current user name by application.user.name
but how do I assign them to the cell in the grid.
your help is most appreciated.
Thank you,
推荐答案
请提及用于给出明确答案的框架版本。
从单元格获取数据来自数据网格
如果它是第一排那么
ctype(dgrd.Items(0).cells(0).Controls(0),DataboundLiteralControl).Text
在调试的即时窗口中检查否。特定细胞中可用的对照。如果您在模板列中使用标签,那么您可以直接将标签转换为Label并且可以使用。
有关此更多详细信息,请提及框架详细信息和单独使用asp.net编码datagrid。
Kindly mention the framework version used to give a clear answer for it.
To get a data from a cell from a datagrid
if it''s the first row then
ctype(dgrd.Items(0).cells(0).Controls(0),DataboundLiteralControl).Text
In the immediate window while debugging check the no. of controls available in the particular cell. If you are using a label inside a Template column, then you can directly typecast to Label and you can use.
For more details about this kindly mention the framework details and the asp.net coding for datagrid alone.
这篇关于如何在datagrid中获取单元格值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!