开发者

ASP.NET Hidden Field Value not modified on callback

开发者 https://www.devze.com 2023-02-28 17:50 出处:网络
I\'m changing the value of an asp:HiddenField during callback. <asp:HiddenField runat=\"server\" ID=\"hiddenField\" Value=\"old value\" />

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

精彩评论

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