Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 在代码隐藏中获取隐藏字段_Asp.net_Vb.net - Fatal编程技术网

Asp.net 在代码隐藏中获取隐藏字段

Asp.net 在代码隐藏中获取隐藏字段,asp.net,vb.net,Asp.net,Vb.net,我一直在这里和其他地方寻找答案,但到目前为止还没有找到确切的方法 我在.aspx页面中对隐藏字段有以下定义: 我在客户端的javascript函数中设置值: 函数confirmAddressChange() { if(文件类型.forms[0].hfAddressChange.valueOf==“未定义”) { var res=(确认('updatecontact address to Rich?')==true); document.forms[0].hfAddressChange.va

我一直在这里和其他地方寻找答案,但到目前为止还没有找到确切的方法

我在.aspx页面中对隐藏字段有以下定义:


我在客户端的javascript函数中设置值:

函数confirmAddressChange()
{
if(文件类型.forms[0].hfAddressChange.valueOf==“未定义”)
{ 
var res=(确认('updatecontact address to Rich?')==true);
document.forms[0].hfAddressChange.valueOf=res;
}
}
基本上我只想设置一次值

现在我想检查代码隐藏中的值:

If hfAddressChange.Value <> String.Empty Then
    Dim x As String = "Do Something here"

End If
如果hfAddressChange.Value字符串为空,则
Dim x As String=“在这里做点什么”
如果结束
然而,即使我已经验证了这个值是在js函数中设置的,当它到达我的代码后面时,它始终是一个空字符串

有人知道我到底做错了什么吗

document.forms[0].hfAddressChange.valueOf = res;
属性是
value
,而不是
valueOf
。(之前也不会是
未定义的
;只需检查
!document.forms[0].hfAddressChange.value


属性是
value
,而不是
valueOf
。(之前也不会是
未定义的
;只需检查
!document.forms[0].hfAddressChange.value

请不要写入
==true
。请确认您没有在页面加载上设置隐藏字段的值。请不要写入
==true
。请确认您没有在页面加载上设置隐藏字段的值。