Click here to Skip to main content
15,936,119 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am facing a problem. I have a hiddenfield in my master page which I am setting using code behind when first page of my application gets load. While navigating from first page to second page, I want that hidden field's value on my second page too. But the value comes as empty string.

I don't want to use session to achieve the above.

please help!!!

Thank you..
Posted
Comments
syed shanu 27-May-14 20:40pm    
Can you post your code here it will be more helpfull to find the solution.Mean time check this link hope this will help for you.
http://stackoverflow.com/questions/15689859/accessing-value-of-a-hidden-field-on-masterpage-from-codebehind

http://stackoverflow.com/questions/10348427/how-to-get-hiddenfield-control-in-masterpage-and-set-its-value

http://forums.asp.net/t/1591819.aspx?master+page+Hidden+Field+Accessed+Through+Content+page

1 solution

The main problem here is you are setting value for the hidden field in first page load and when the second page is loaded the hidden field refreshed with default value.

You also dont want to use session.

Then the only way here is to pass the value in query string if it is short enough to do the same.

Ex :-

From Page1 :
C#
Response.Redirect("~/Page2.aspx?value=test");


In Page2 load :-
C#
if (Request.QueryString["value"] != null)
{
   var val = Request.QueryString["value"];
}



Hope this will be of help.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900