tags:

views:

19

answers:

1

I have a GUI that contains several components (combo boxes, textboxes, etc) with their associated labels. When a button is pressed, the selection in each input component is validated, and if found to contain an invalid value, the label color changes to red and an error message appears. This works fine on its own.

The problem arises when invalid values are provided and then later fixed. When the user presses the button and the inputs are valid, I redirect the response to an asp using Response.Redirect, which then runs and opens a PDF report. When this happens, none of the code to change the labels back to their original color or to remove the error message runs. If I change Response.Redirect() to Server.Transfer() and the user goes back, it returns the page to its original state (removing the error messages), but I want to keep the valid data in each component.

What can I do to either remove the error messages when the user goes back or to retain the valid input from the user?

EDIT: Most of the controls are non-standard .NET controls and I'm working with VB.NET 2003.

A: 

What you need is a way to save data during transition. So the first time the validation is passed store the values into Session variables.

Session ("TextBox1Value") = 'Something1'
Session ("ComboBoxValue") = 'Something2'

When you comeback to page all you have to do is:

TextBox1.Text = Session("TextBox1Value")

This will help to preserve values as long as the browser is open across multiple pages. Look at the link below for a simple example:

http://www.java2s.com/Code/ASP/Session-Cookie/UsesessionvariablesVBnet.htm

maxthephilosopher