TI已在aspx中定义了隐藏文件: -
<asp:HiddenField runat ="server" ID="hfBrand" value = "False" />
组合框控件正在调用JavaScript函数函数: -
<telerik:RadComboBox ID="Brands" runat="server"
onclientselectedindexchanged="LoadProperties"
AutoPostBack="True">
</telerik:RadComboBox>
在该函数中,我试图将隐藏字段值设置为“True”: -
function LoadProperties(sender, eventArgs)
{
var lblBrand = document.getElementById('<%= hfBrand.ClientID %>').value;
alert(lblBrand);
document.getElementById('<%= hfBrand.ClientID %>').value = "True";
var NewlblBrand = document.getElementById('<%= hfBrand.ClientID %>').value
alert(NewlblBrand)
}
在服务器端(Brands.aspx.cs),我正在尝试获取隐藏字段值: -
if (hfBrand.Value == "True")
brandIDSelected = "10";
else
brandIDSelected = "20";
问题: - - &gt; hfbrand.Value仍然是'False',即使我在javascript中将其设置为'True'。为什么这样。请帮忙。
由于