Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 568
  • Last Modified:

text box in the master page retaining text across content pages

I have a text box in master page. When the user enters text and hits on the search button, the user is redirected to another content page. However the value in the textbox that was entered by the user is not retained in the new content page. Please suggest how I can retain the value. thanks
2 Solutions
Richard LeeSoftware EnthusiastCommented:
If you use a redirect to another page then the ViewState is lost. ViewState is per page and used to maintain the value of the textbox across postbacks. Saying all of that I get to the solution finally - you will need to pass the value across to the other page. The best way is by QueryString. Why I hear you ask, well you could just as done with google distribute a search just using the URL.

There is a multitude of ways you go about doing this.

1. Store value in Session Variable: http://www.codeproject.com/KB/aspnet/ExploringSession.aspx

2. Store value in Cookie: http://www.geekpedia.com/tutorial81_Handling-cookies-in-ASP-.NET.html

3. Access Previous Page Values: http://www.aspdotnetfaq.com/Faq/How-to-make-Cross-Page-Postback-in-ASP-Net.aspx

4. Storing value in Query String: http://www.aspnet101.com/2007/07/querystring-results-and-sql-statements/

5. Store value in database on source page, then access the value on target page.
TrialUserAuthor Commented:

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now