如何访问gridview的项目模板中的控件 [英] how to access the controls in the item template of a gridview
问题描述
我正在尝试制作一个可编辑的网格,我的要求是网格的最后一列应为单击时的链接按钮编辑",应将该行中的所有其他列转换为文本框以启用edting,最后一列应具有保存并取消按钮,而不是编辑按钮.
为此,我将网格的列转换为itemtemplate,并在其中使用readonly ="true"添加了文本框,并添加了带有按钮字段(编辑)的新列,现在我想将这些文本框转换为readonly ="false",但是即时通讯无法访问这些文本框,请告诉我访问它们的方式
i am trying to make a editable grid, my requirement is that last column of the grid should be a link button "edit" on click which should convert all other column in that row as a textbox to enable the edting and last column should have a save and cancel button instead of edit button.
To attain this i converted a the column of my grid to itemtemplate and added textbox in it with readonly = "true" and added a new column with button field (edit) now i want to convert those textbox as readonly="false" but i m not able to access those textboxes please tell me the way toi access them
推荐答案
请在此处找到更多所需的内容:
可编辑的嵌套GridView(多合一) [
Please find more than what you need here:
Editable Nested GridView (All-in-One)[^]
You can see the codebase of how your requirement was done in it.
您可以使用网格视图的find控件属性..
例如textbox text =(textbox)(gridview1.findcontrol(txctbox2).text.tostring());
you can use the find control property of the grid view..
like textbox text=(textbox)(gridview1.findcontrol(txctbox2).text.tostring());
这篇关于如何访问gridview的项目模板中的控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!