ASP.NET Hidden Field Value not modified on callback
I'm changing the value of an asp:HiddenField during callback.
<asp:HiddenField runat="server" ID="hiddenField" Value="old value" />
private void Page_Load(object sender, EventArgs e)
{
if (IsCallBack)
{
hiddenField.Value = "new value";
}
}
but after the callback, the value of the hidden field is "old value". When debugging, I can see that the value of the hidden field is "new value". I would like to know why it is retai开发者_如何学Cning the original value. Thanks.
I think you are trying to change the value of the Hidden Field in Async/partial post back but your Hidden field is not in the update panel.
Edit: You need to put your hidden field in the update panel.
精彩评论