I have a vb.net application in which a grid view is there with a hidden field. I want to get the value of that hidden cell
我有一个vb.net应用程序,其中有一个隐藏字段的网格视图。我想得到隐藏细胞的价值
Code behind statusGrdvw.Rows(assign).Cells(5).Text
代码隐藏状态Grdvw.Rows(assign).Cells(5).Text
3 个解决方案
#1
0
Well you can add this style in the html
那你可以在html中添加这个样式
<style>
.hidden {display:none;}
#exportother {
position: relative;
top: 13px;
left: -840px;
}
</style>
Then on the field you want to hide
然后在你要隐藏的字段上
ItemStyle-CssClass="hidden"
HeaderStyle-CssClass="hidden"
The field will be hidden but will be accessible from code behind.
该字段将被隐藏,但可以从后面的代码访问。
#2
0
You didn't provide much to go on but what you need to do is get it by its control index. So basically if you have 2 controls in one column you have a control at index 0 and index 1. Something like this (you'll have to look up the exact syntax):
您没有提供太多内容,但您需要做的是通过其控制索引获取它。所以基本上如果你在一列中有2个控件,你在索引0和索引1有一个控件。这样的东西(你必须查找确切的语法):
((HiddenInput)statusGrdvw.Rows(assign).Cells(5).Controls[0]).Value
#3
0
Try this one to fetch the value in hidden field :
试试这个来获取隐藏字段中的值:
Dim hidden2 As String = CType(statusGrdvw.SelectedRow.Cells(5).FindControl("HiddenfieldID"), HiddenField).Value;
#1
0
Well you can add this style in the html
那你可以在html中添加这个样式
<style>
.hidden {display:none;}
#exportother {
position: relative;
top: 13px;
left: -840px;
}
</style>
Then on the field you want to hide
然后在你要隐藏的字段上
ItemStyle-CssClass="hidden"
HeaderStyle-CssClass="hidden"
The field will be hidden but will be accessible from code behind.
该字段将被隐藏,但可以从后面的代码访问。
#2
0
You didn't provide much to go on but what you need to do is get it by its control index. So basically if you have 2 controls in one column you have a control at index 0 and index 1. Something like this (you'll have to look up the exact syntax):
您没有提供太多内容,但您需要做的是通过其控制索引获取它。所以基本上如果你在一列中有2个控件,你在索引0和索引1有一个控件。这样的东西(你必须查找确切的语法):
((HiddenInput)statusGrdvw.Rows(assign).Cells(5).Controls[0]).Value
#3
0
Try this one to fetch the value in hidden field :
试试这个来获取隐藏字段中的值:
Dim hidden2 As String = CType(statusGrdvw.SelectedRow.Cells(5).FindControl("HiddenfieldID"), HiddenField).Value;