How to preserve values in a web form when navigating to a different page and then going back to the original page using the back button ?


 I am working on a C#/ASP.NET web application. The web application basically consist of 3 web forms. Each form contains several controls such as an edit box, and some drop down list box controls. Basically I need to find out how to preserve the values in a web form when a person navigates to a different page. For example, suppose that in my web application I navigate from my first page (First.aspx) to my second page (Second.aspx). Now if I press the browsers back button, I want the application to retain the values for the controls that were in my first web form "first.aspx", and for these values to be displayed on the form as they were before I navigated to the second page. How can I do this?


1/17/2007 9:01:24 PM 93655 articles. 5 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 10

Only way to retain values between pages is by vausing POSTBACK before navigating to next page and enabling VIEWSTATE.

Hope this helps.

1/17/2007 9:14:04 PM

You can also store it on Sessions and restore them back from sessions to controls

My Blog
Please click on 'Mark as Answer' if this post answered your question!
1/17/2007 9:22:21 PM


read about this

hope it helps

Jessica Cao
Microsoft Online Community Support

“Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
1/18/2007 1:42:51 AM

Similar Artilces:

How to preserve the value of a form field when the user press a "BACK" button on my web page?
Hi all,  I have 3 forms with some text fields and checkboxes. I move from Form1 to Form2, and then to Form3. I use session variables to pass values between forms. Now the problem is, when I am in Form3, when the user clicks a "BACK" button on Form3, he should be taken to Form2. At this stage, the data he entered on Form2 should be there as it was! For this, should I load back the values of each field from the session variables? Or is there any automated method to do this (may be from the viewstate etc.)? Can anyone help me? Thanking you in advance, Tomy Viewstate works onl...

Going back to the same page and row in a Datagrid after coming back from another Web Form
Upon clicking the Select button on a row of a multi-page Datagrid, a new Web Form containg the details of the clicked item is displayed. When the user finishes viewing the details, he clicks the OK button to go back to the Datagrid form. The question is: how can we display the original Datagrid page with the original selected row highlighted? I know ItemIndex of the Datagrid contains the current row #, but how do we get the current page # of a multi-page datagrid? Can you display the Datagrid page with this page #?Please help. Thanks in advance.sg2000 look at this blog post.. Might he...

Can my web page with a form submit to other web pages forms?
I was wondering if I created an aspx page that had a form on it that I could use the submit button to submit this form's contents to other web pages forms(servers accepting those form's data). I am thinking this would be a great way to update data on particular web pages without having to actually visit those similar web pages. Any ideas, examples would be much appreciated. Thanks in advance.  Yes you can.  It's called Cross Page Posting: might ...

How to programmatically use the red X (close) button of a web form (web page)?
Hello All! I have developped a web application that has controls on it and lets the users enter in data and save in a database. Now, what I would like to do is to code the event procedure of the red X (close) button of a web form (web page) so that, when users click on the button to try to close the page, a window is displayed to the user, asking him/her if he/she would like to save the data entered in the controls of the web form (web page). I would like to point out that I DON'T want to use an actual button, like I saw in most of the websites I visited, ...

Pass values from a web form to another page using a button
I'm trying to do a simple survey, where a user fills out a form and then clicks submit. The button sends them to a new page along with their answers from the form. How do I get it to send the values to the new page? Thanks you can do redirect at the end of button_click handler and pass the parametersAnatoly Lubarsky...

How to pass form values to a page using button web controls?
I am having problems working out how to produce some code for a web site administration section. What I am trying to do is to show a list of the categories, as taken from the database. There are then buttons to edit or delete a selected category, as well as the ability to add a new category. What I have done previously, in ASP, is to have a form at the top of the page with a couple of hidden fields, one for the action and one for the category ID, and then used javascript to change those values according to which button was pressed, and submitted the form. So far, I have used a Repeater...

how to open a web page in form of a popup web page
Hello, I have two web pages, let say. Page A : With a Button on it. PAge B: with some info. Now I need to: When I click on the Button of page A.Page B must open in a pop up window.  I can do this but problem is this when I clicked on the button for first time it does not show me any thing and when I clicked on the button for second time then It shows me Page B .My code is as follow:  1 protected void Page_Load(object sender, EventArgs e) 2 { 3 if (!this.Page.IsPostBack) 4 { 5 6 } 7 else 8...

can someone one give me difference between web form and mobile web form and which or where or when i'm using the forms?
thanks Marc Hi Marc, Based on my understanding, you want to know the differences between the ASP.NET web application and ASP.NET mobile web application. If I have misunderstood you, please feel free to let me know. The ASP.NET forms are used to develop the ASP.NET pages for desktop browsers and The ASP.NET mobile forms are used to develop the ASP.NET pages for mobile device browsers. When we create the ASP.NET mobile web forms pages, we can use nearly all the features of ASP.NET. But there are a couple of compatibility issues: Error Handling and Reporting. Tracing. Using Redi...

Go Back to previous page using Back button
Hi Experts, In my application, I have a 2 pages online employment form that user can fill out the information, click "continue" for 2nd page, then click "Submit" or "Back" button. However, when I click the "Back" button, it brings back to a blank form and all the data I used enetered is gone. HOW CAN I RETURN TO THE PREVIOUS PAGE WITH DATA THAT JUST ENTERED?  ThANKS! In first page, the continue button click event:Sub btnContinue_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnContinue.Click         &n...

Open web page in IE and populate fields on the form from my web form
To the dot net Knights.  Many humble thanks in advance from a dot net surf. We have an vb application that opens multiple instances of IE object, each to different web pages.  It then takes information from the current record in the app, populates fields on each of the web pages, and them submits the forms.  We are then able to look at the resulting web pages and quickly get the info we're looking for.This prevents us from having to manually navigate to each web site, enter the same information and then wait for the page to open.  If there is ...

BackSpace Why use it to go back on web pages
Name: James Hull Email: StealTow411ataoldotcom Product: Firefox Summary: BackSpace Why use it to go back on web pages Comments: The backspace button shouldn't make the page go back one if your not in a text box and press it. What if your using a lap top and your thumb kinda graces the mouse thing. and you fuck up at the same time you hit backspace and bam all the shit you where writing is gone. i think alt+left is sufficent for going backwords if people want to use the keyboard. Please Please Please Please make it so backspace doesn't make the page go back one. ...

"Page has expire" when going back using back button
My page has two controls - a calendar control and a datagrid control. When the page is first loaded, only the calendar control is displayed. When the user has selected a date from the calendar control, the datagrid will be populated with info corresponding to the selected date. In the grid, there is a hyperlink column to pdf page. When I click the the hyperlink, it will bring me to the pdf page. From the pdf page, I am trying to go back to the previous page using the back button in the browser, I got "Page has expired". When I hit the "refresh", I got my page ...

4 Layered Web Application for Inserting data into a database using sql server as the back end and a web form as the front end using C#
4 Layered Web Application for Inserting data into a database using sql server as the back end and a web form as the front end using C# . Can someone provide with code as I am new to this architecture and framework. Better send email. Thanks In Advance, A New Bie I suggest taking a look at the Time Tracker Starter Kit (v1.x or x2.0) or the Issue Tracker Starter Kit (v1.x).  Full source code is available.  Click on the Downloads tab above to find them.  These are not exactly what you are looking for, but perhaps they will help you get started.Terri MortonEngagement Manag...

Go Back One Page has no pull down for going back more than 1 page
Name: Tom Email: tangoattiacdotnet Product: Firefox Summary: Go Back One Page has no pull down for going back more than 1 page Comments: I find this to be a regression, as in previous releases enjoyed the feature of being able to go back more than one web page at a time. Bring back this feature, please! From URL: ...

Web resources about - How to preserve values in a web form when navigating to a different page and then going back to the original page using the back button ? -

Navigating Facebook With Gestures? PointGrab, Asus Make It Happen
Facebook users accessing the social network via the latest line of Asus All-in-One devices will be able to use gesture solutions to navigate ...

Navigating the News With the Upshot
By David Leonhardt The New York Times You have no shortage of excellent news sources — sources that expertly report and analyze news as it ...

Navigating the Transition from Founder to CEO
People often equate success in business with qualities like vision, skill, passion, sheer force of will, and other dynamics that are solely within ...

Navigating NAPLAN: Testing times for parents
The NAPLAN tests have been taken, now parents have to try to understand what the results mean.

Site map - Navigating website -
Skip to: Main Content Site Navigation Site Footer Site Search Site Map Network Navigation (other sites) Fox Sports CareerOne Carsguide ...

It's tough navigating the winds of change
Australian governments are like students' bedsheets. They don't get changed often enough.

Explainer: Navigating the high seas of online piracy
George Brandis has labelled Australians the worst pirates in the world. But will the government's proposed solutions be effective? Hannah Francis ...

Navigating the nudists at Kambah Pools
The secret to enjoying the Kambah Pool is simple: go left if you brought your swimmers and go right if you didn't.

Navigating the downturn in the Canadian economy
The price of oil has plunged, the dollar's down but last month the Prime Minister was offering reassuring words that the economy will be okay. ...

South Korea ferry disaster: All involved in navigating ship now in custody - CTV News
All 15 people involved in navigating the South Korean ferry that sank and left more than 300 people dead or missing are now in custody after ...

Resources last updated: 1/13/2016 10:38:45 PM