Click here to Skip to main content
15,897,273 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralASP:menu control question Pin
ChrisFarrugia25-Mar-08 3:24
ChrisFarrugia25-Mar-08 3:24 
GeneralRe: ASP:menu control question Pin
gauthee25-Mar-08 4:05
gauthee25-Mar-08 4:05 
GeneralRe: ASP:menu control question Pin
Jesse Squire25-Mar-08 4:08
Jesse Squire25-Mar-08 4:08 
GeneralRe: ASP:menu control question Pin
Declan Bright25-Mar-08 4:16
Declan Bright25-Mar-08 4:16 
GeneralSend Mail Pin
mehrdadc4825-Mar-08 2:59
mehrdadc4825-Mar-08 2:59 
GeneralRe: Send Mail Pin
eyeseetee25-Mar-08 3:07
eyeseetee25-Mar-08 3:07 
QuestionHow to retrieve the value of textbox using session Pin
anpm25-Mar-08 2:18
anpm25-Mar-08 2:18 
GeneralRe: How to retrieve the value of textbox using session Pin
Jesse Squire25-Mar-08 2:38
Jesse Squire25-Mar-08 2:38 
The easiest way to accomplish what you are looking to do, would be to put some code in the click handler of the button that is responsible for performing your redirection. In that code, you'll simply read the current value from your textbox and place it into Session.

In your default page's Load event handler, test for postback. If the current request is not a postback, attempt to read the textbox value from Session and restore it. The code to do so would look something like:

  protected void Page_Load(object sender, EventArgs ea)

  {

    if ((!this.IsPostBack) && (!String.IsNullOrEmpty(Session["MY_DEFAULT_TEXTBOX_VALUE"]))

    {

      this.MyTextBox.Text = Session["MY_DEFAULT_TEXTBOX_VALUE"];

    }

  }

 

  protected void Button_Click(object sender, EventArgs ea)

  {

    Session["MY_DEFAULT_TEXTBOX_VALUE"] = this.MyTextBox.Text;

    Response.Redirect("mysecondpage.aspx");

  }


I'm assuming that you're performing your redirection from the server-side. I have also made the assumption that you are either not working in a web farm scenario, have IP affinity set, or are using SQL session management. If any of those are not the case, please note it and we can discuss some alternatives.

Hope that helps. Smile | :)

  --Jesse
"... the internet's just a big porn library with some useful articles stuck in." - Rob Rodi

QuestionRe: How to retrieve the value of textbox using session Pin
anpm25-Mar-08 14:44
anpm25-Mar-08 14:44 
GeneralRe: How to retrieve the value of textbox using session Pin
Jesse Squire25-Mar-08 15:44
Jesse Squire25-Mar-08 15:44 
QuestionRe: How to retrieve the value of textbox using session Pin
anpm25-Mar-08 16:06
anpm25-Mar-08 16:06 
GeneralRe: How to retrieve the value of textbox using session Pin
eyeseetee25-Mar-08 3:00
eyeseetee25-Mar-08 3:00 
Questionrefreshing the page Pin
Pankaj Garg25-Mar-08 0:55
Pankaj Garg25-Mar-08 0:55 
GeneralRe: refreshing the page Pin
eyeseetee25-Mar-08 1:23
eyeseetee25-Mar-08 1:23 
GeneralRe: refreshing the page Pin
Pankaj Garg25-Mar-08 1:42
Pankaj Garg25-Mar-08 1:42 
GeneralRe: refreshing the page Pin
Declan Bright25-Mar-08 1:43
Declan Bright25-Mar-08 1:43 
Questionmessage box button code Pin
Pankaj Garg25-Mar-08 0:18
Pankaj Garg25-Mar-08 0:18 
GeneralRe: message box button code Pin
Christian Graus25-Mar-08 0:37
protectorChristian Graus25-Mar-08 0:37 
QuestionRe: message box button code Pin
Pankaj Garg25-Mar-08 0:48
Pankaj Garg25-Mar-08 0:48 
GeneralRe: message box button code Pin
Christian Graus25-Mar-08 1:02
protectorChristian Graus25-Mar-08 1:02 
QuestionRe: message box button code Pin
Pankaj Garg25-Mar-08 1:14
Pankaj Garg25-Mar-08 1:14 
GeneralRe: message box button code Pin
Christian Graus25-Mar-08 10:01
protectorChristian Graus25-Mar-08 10:01 
GeneralRe: message box button code Pin
eyeseetee25-Mar-08 0:55
eyeseetee25-Mar-08 0:55 
JokeRe: message box button code Pin
Pankaj Garg25-Mar-08 1:01
Pankaj Garg25-Mar-08 1:01 
GeneralRe: message box button code Pin
lakshmichawala25-Mar-08 1:58
lakshmichawala25-Mar-08 1:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.