Reputation: 1
I have stored a string value in a hidden field of a page. How to access it from a different webpage?
Upvotes: 0
Views: 2938
Reputation: 214
You can also use cookies to transfer the value across pages. May be you would want to read this piece of article to know more about the state management. Do read it. Will definitely gonna help you. You can decide what you want to use after reading this.
Hope it helps you. http://www.codeproject.com/KB/vista/ASPNet_State_Management.aspx
Upvotes: 0
Reputation: 3196
If you don't mind using jQuery, and as long as the pages are on the same domain, then you can do it with the .load()
method. This method basically does a GET
request to the page
Page with hidden field
<div id="hiddenValue">Value</div>
Page you're calling from
$('#newDiv').load('path/to/page.aspx #hiddenValue');
additional notes:
If they are on different domains then your only other options are:
Query Strings
Sessions
references:
Upvotes: 0
Reputation: 7076
On the page that contains the hidden value, you could post that form to the other page and get the value from this.Request.Form["hidden-field"].
Is that the sort of answer you are looking for? Maybe more details would help.
Good luck!
Upvotes: 0
Reputation: 1044
You have two options.
a. Putting that string value in a Session.
string value="value"; Session["myValue"] = value;
b. Transmitting that value in the url.
string value="value";
Response.Redirect("./Mypage.aspx?value="+value);
Upvotes: 1