开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜