How to avoid the value of the hidden field of the main page lost when loading a new page.

I have a hidden field on the main page. I set its value on the child page via JavaScript. When I click the link on this child page, it redirects to another page. Now I want to get the value of the hidden field on this new child page. But value is lost (obviously). How can I save this value.

Thank you all for your help in advance.

+5
source share
8 answers

You can pass the value in the query string as follows:

http://YourUrl.com/YourPage.aspx?YourValue=foo

AJAX, , page_load .

+2

, .

ajax .

0

- javascript, URL- , cookie.

0

, , , Response.Redirect . . ajax .

0

, OnPageLoad - .

0

-, ? .

0

viewstate ,

public string NavigateUrl
{
 get
  {
    string text = (string) ViewState["NavigateUrl"];
    if (text != null)
       return text;
    else
       return string.Empty;
  }
  set
  {
    ViewState["NavigateUrl"] = value;
  }
}
0

All Articles