Forms State

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dear All,

I have 4 web ASP.net Forms. I use a image control to move between these
forms.The problem I am facing is that I cannot preserve the state of
the form
when moving between different forms. For example, on my first form I
have a
question, a text box and a button. The user sees the question and then
writes
answer in the text box and then presses submit button.as soon as he
presses
submit button his answer is stored in the database and a label control
is
displayed which gives a real correct answer. and on the bottom of the
form is
an image control which has an image of Next question on it. As soon as
the
user presses next question it takes him to a new form. that works
fine.But If I
try to come back to first form.The form reloads.I dont see the
correct answer
label. It looks like the form is REFRESHED and the only thing is can
see is that
question,text box and submit button again.I can't see the label
control which
has the correct answer.


Is there some way I can store the last action of the user between
different
forms.I checked the EnableViewState property of the form but its all
true.
below is some of the code.

Form load Event

If Not IsPostback

label.visible=false
end sub

Button_click


label.visible=true

end sub


Any help much appreciated.

cheers,
Sunil Sabir
 
My guess is you'll have to store the user's responses in session variables
(or other datastore such as a database or XML file). When the page is
loaded it pre-loads with data from the datastore, if datastore is empty,
then the person has not answered the question then display "new/fresh" form.
 
Back
Top