无法从代码后面访问隐藏变量 [英] Unable To access Hidden variable from code behind
问题描述
当我从我的代码后面访问我的隐藏变量iam得到的值为0而不是失败时,我通过发出警告检查,它进入if循环。所以那里没有问题。
函数CheckDllsTxt(){
$('select')。each(function(){
if(($(this).val())==' - 1'){
document.getElementById('<%= HdnValidation.ClientID%>')。value ='失败';
}
});
< asp:HiddenField ID =HdnValidationValue =0runat =server/>
i将其置于更新面板的内部和外部
C#:
ScriptManager.RegisterStartupScript(this,this.GetType(),alertUser,CheckDllsTxt();,true);
if(HdnValidation.Value ==失败)
{
}
其他
{
}
函数CheckDllsTxt();也在调用,但是我得到了HdnValidation.Value = 0,请帮我解决
Hi,
when i access my hidden variable from my code behind iam getting the value as 0 instead of failed ,i checked by putting alert,its entering into the if loop.so no problem there.
function CheckDllsTxt() {
$('select').each(function () {
if (($(this).val()) == '-1') {
document.getElementById('<%=HdnValidation.ClientID%>').value = 'Failed';
}
});
<asp:HiddenField ID="HdnValidation" Value="0" runat="server"/>
i placed it both inside and outside of the update panel
C#:
ScriptManager.RegisterStartupScript(this, this.GetType(), "alertUser", "CheckDllsTxt();", true);
if (HdnValidation.Value == "Failed")
{
}
else
{
}
the Function CheckDllsTxt(); is also invoking,but iam getting HdnValidation.Value=0,pls help me out
推荐答案
('select')。each(function(){
if((
('select').each(function () {
if ((
(this).val())==' - 1'){
document.getElementById('<% = HdnValidation.ClientID%>')。value ='失败';
}
});
< asp:HiddenField ID =HdnValidationValue =0runat =server/>
i放置它在更新面板的内部和外部
C#:
ScriptManager.RegisterStartupScript(this,this.GetType(),alertUser ,CheckDllsTxt();,true);
if(HdnValidation.Value ==失败)
{
}
其他
{
}
函数CheckDllsTxt();也在调用,但我得到HdnValidation.Value = 0,请帮帮我
(this).val()) == '-1') {
document.getElementById('<%=HdnValidation.ClientID%>').value = 'Failed';
}
});
<asp:HiddenField ID="HdnValidation" Value="0" runat="server"/>
i placed it both inside and outside of the update panel
C#:
ScriptManager.RegisterStartupScript(this, this.GetType(), "alertUser", "CheckDllsTxt();", true);
if (HdnValidation.Value == "Failed")
{
}
else
{
}
the Function CheckDllsTxt(); is also invoking,but iam getting HdnValidation.Value=0,pls help me out
这篇关于无法从代码后面访问隐藏变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!