For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > September 2004 > Forms State









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Forms State
Sunil Sabir

2004-09-30, 4:08 pm

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

i. Wiin

2004-09-30, 4:08 pm

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.

"Sunil Sabir" <SunilSabir@discussions.microsoft.com> wrote in message
news:F854C8E8-CD2C-41F1-8F37-5928DC9B2DC1@microsoft.com...
> 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
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com