|
 |
aspx thread: How NOT to maintain a state of a form
Message #1 by kamathamit@p... on Thu, 26 Apr 2001 06:44:56
|
|
Hi,
I am developing an intranet application in which, after Form is
submitted ,in case it has errors the form is displayed again ( the state
is maintaine thanks to ASP+) but in case there are no errors the data is
added to the Database ( Got this working too) & the same form is displayed
again.
My problem is When the Form is Displayed again after a Succesful entery
it shoul NOT maintain its state i.e. the textboxes should appear empty.
Amit Kamath
Message #2 by "Thomas Tomiczek" <t.tomiczek@t...> on Thu, 26 Apr 2001 10:08:15 +0200
|
|
Well,
then clear out the text boxes in the code that makes the database
insert. Thats simple, and the same model like with VB forms.
When you want the fields to clear up, clear them up.
Thomas Tomiczek
THONA Consulting Ltd.
-----Original Message-----
From: kamathamit@p... [mailto:kamathamit@p...]
Sent: Donnerstag, 26. April 2001 08:45
To: ASP+
Subject: [aspx] How NOT to maintain a state of a form
Hi,
I am developing an intranet application in which, after Form is
submitted ,in case it has errors the form is displayed again ( the state
is maintaine thanks to ASP+) but in case there are no errors the data
is
added to the Database ( Got this working too) & the same form is
displayed
again.
My problem is When the Form is Displayed again after a Succesful
entery
it shoul NOT maintain its state i.e. the textboxes should appear empty.
Amit Kamath
Message #3 by "Juan T. Llibre" <j.llibre@c...> on Thu, 26 Apr 2001 06:26:30 -0500
|
|
<%@ Page MaintainState="false"%>
regards,
Juan T. Llibre
Microsoft MVP [IIS/ASP]
ASP.Net En Espaņol : http://207.176.17.140/
http://p2p.wrox.com/subscribe.asp?list=aspx_espanol
http://www.asplists.com/asplists/aspnges.asp
==================================
----- Original Message -----
From: <kamathamit@p...>
To: "ASP+" <aspx@p...>
Sent: Thursday, April 26, 2001 6:44 AM
Subject: [aspx] How NOT to maintain a state of a form
> Hi,
>
> I am developing an intranet application in which, after Form is
> submitted ,in case it has errors the form is displayed again ( the state
> is maintaine thanks to ASP+) but in case there are no errors the data is
> added to the Database ( Got this working too) & the same form is displayed
> again.
>
> My problem is When the Form is Displayed again after a Succesful entery
> it shoul NOT maintain its state i.e. the textboxes should appear empty.
>
> Amit Kamath
Message #4 by "Thomas Tomiczek" <t.tomiczek@t...> on Thu, 26 Apr 2001 12:42:22 +0200
|
|
No,
He WANT to maintain the state, EXCEPT for ONE operation that works. Your
solution kills off the state maintenance completely.
Thomas Tomiczek
-----Original Message-----
From: Juan T. Llibre [mailto:j.llibre@c...]
Sent: Donnerstag, 26. April 2001 13:27
To: ASP+
Subject: [aspx] Re: How NOT to maintain a state of a form
<%@ Page MaintainState=3D"false"%>
regards,
Juan T. Llibre
Microsoft MVP [IIS/ASP]
ASP.Net En Espa=F1ol : http://207.176.17.140/
http://p2p.wrox.com/subscribe.asp?list=3Daspx_espanol
http://www.asplists.com/asplists/aspnges.asp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D
----- Original Message -----
From: <kamathamit@p...>
To: "ASP+" <aspx@p...>
Sent: Thursday, April 26, 2001 6:44 AM
Subject: [aspx] How NOT to maintain a state of a form
> Hi,
>
> I am developing an intranet application in which, after Form is
> submitted ,in case it has errors the form is displayed again ( the
state
> is maintaine thanks to ASP+) but in case there are no errors the data
is
> added to the Database ( Got this working too) & the same form is
displayed
> again.
>
> My problem is When the Form is Displayed again after a Succesful
entery
> it shoul NOT maintain its state i.e. the textboxes should appear
empty.
>
> Amit Kamath
Message #5 by "Juan T. Llibre" <j.llibre@c...> on Thu, 26 Apr 2001 07:41:46 -0500
|
|
Hi, Thomas.
Uh, oh...
In that case, it's hard to have your cake and eat it, too...;>)
Either you maintain state or not maintain state.
No halfway measures in state maintenance...
Maybe, adding a button which links to a "clean" page
( identical to the one in which he's doing the operation
except that it does NOT maintain state ), and which
posts back to the original page, would be a workaround.
Juan T. Llibre
Microsoft MVP [IIS/ASP]
ASP.Net En Espaņol : http://207.176.17.140/
http://p2p.wrox.com/subscribe.asp?list=aspx_espanol
http://www.asplists.com/asplists/aspnges.asp
==================================
----- Original Message -----
From: "Thomas Tomiczek" <t.tomiczek@t...>
To: "ASP+" <aspx@p...>
Sent: Thursday, April 26, 2001 5:42 AM
Subject: [aspx] Re: How NOT to maintain a state of a form
No,
He WANT to maintain the state, EXCEPT for ONE operation that works. Your
solution kills off the state maintenance completely.
Thomas Tomiczek
-----Original Message-----
From: Juan T. Llibre [mailto:j.llibre@c...]
Sent: Donnerstag, 26. April 2001 13:27
To: ASP+
Subject: [aspx] Re: How NOT to maintain a state of a form
<%@ Page MaintainState="false"%>
regards,
Juan T. Llibre
Microsoft MVP [IIS/ASP]
ASP.Net En Espaņol : http://207.176.17.140/
http://p2p.wrox.com/subscribe.asp?list=aspx_espanol
http://www.asplists.com/asplists/aspnges.asp
==================================
----- Original Message -----
From: <kamathamit@p...>
To: "ASP+" <aspx@p...>
Sent: Thursday, April 26, 2001 6:44 AM
Subject: [aspx] How NOT to maintain a state of a form
> Hi,
>
> I am developing an intranet application in which, after Form is
> submitted ,in case it has errors the form is displayed again
> ( the state is maintaine thanks to ASP+) but in case there are no
> errors the data is added to the Database ( Got this working too) &
> the same form is displayed again.
>
> My problem is When the Form is Displayed again after a Succesful
> entery it shoul NOT maintain its state i.e. the textboxes should appear
> empty.
>
> Amit Kamath
Message #6 by "Thomas Tomiczek" <t.tomiczek@t...> on Thu, 26 Apr 2001 14:24:55 +0200
|
|
Juan,
Actually that's it.
To reset the state in the window (completely) you just need to redirect
back to the page.
Wonderful. Thanks for pointing this out to me - I did not see it and
have a similar problem myself. Much easier than cleaning and manually
resetting all the controls.
Regards
Thomas Tomiczek
THONA Consulting Ltd.
-----Original Message-----
From: Juan T. Llibre [mailto:j.llibre@c...]
Sent: Donnerstag, 26. April 2001 14:42
To: ASP+
Subject: [aspx] Re: How NOT to maintain a state of a form
Hi, Thomas.
Uh, oh...
In that case, it's hard to have your cake and eat it, too...;>)
Either you maintain state or not maintain state.
No halfway measures in state maintenance...
Maybe, adding a button which links to a "clean" page
( identical to the one in which he's doing the operation
except that it does NOT maintain state ), and which
posts back to the original page, would be a workaround.
Juan T. Llibre
Microsoft MVP [IIS/ASP]
ASP.Net En Espa=F1ol : http://207.176.17.140/
http://p2p.wrox.com/subscribe.asp?list=3Daspx_espanol
http://www.asplists.com/asplists/aspnges.asp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D
----- Original Message -----
From: "Thomas Tomiczek" <t.tomiczek@t...>
To: "ASP+" <aspx@p...>
Sent: Thursday, April 26, 2001 5:42 AM
Subject: [aspx] Re: How NOT to maintain a state of a form
No,
He WANT to maintain the state, EXCEPT for ONE operation that works. Your
solution kills off the state maintenance completely.
Thomas Tomiczek
-----Original Message-----
From: Juan T. Llibre [mailto:j.llibre@c...]
Sent: Donnerstag, 26. April 2001 13:27
To: ASP+
Subject: [aspx] Re: How NOT to maintain a state of a form
<%@ Page MaintainState=3D"false"%>
regards,
Juan T. Llibre
Microsoft MVP [IIS/ASP]
ASP.Net En Espa=F1ol : http://207.176.17.140/
http://p2p.wrox.com/subscribe.asp?list=3Daspx_espanol
http://www.asplists.com/asplists/aspnges.asp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D
----- Original Message -----
From: <kamathamit@p...>
To: "ASP+" <aspx@p...>
Sent: Thursday, April 26, 2001 6:44 AM
Subject: [aspx] How NOT to maintain a state of a form
> Hi,
>
> I am developing an intranet application in which, after Form is
> submitted ,in case it has errors the form is displayed again
> ( the state is maintaine thanks to ASP+) but in case there are no
> errors the data is added to the Database ( Got this working too) &
> the same form is displayed again.
>
> My problem is When the Form is Displayed again after a Succesful
> entery it shoul NOT maintain its state i.e. the textboxes should
appear
> empty.
>
> Amit Kamath
---
SoftArtisans helps developers build robust, scalable Web applications!
Excel Web reports, charts: http://www.softartisans.com/excelwriter.html
File uploads: http://www.softartisans.com/saf.html
Transactional file management: http://www.softartisans.com/saf1.html
Scalability: http://www.softartisans.com/saxsession.html
ASPstudio value pack: http://www.softartisans.com/aspstudiosuite.html
Message #7 by "Robert Lair" <mailinglists@a...> on Thu, 26 Apr 2001 09:40:26 -0400
|
|
I am not completely sure that manually clearing all the textboxes is the
only solution to this problem. It wouldn't surprise me if there was a way
to use one or two statements to clear the ViewState and clear the textboxes.
You are correct that we do not want to turn off ViewState... however, the
ViewState object is a StateBag, and the StateBag object has a method called
Clear(). So, I tried ViewState.Clear(). Doesn't work however. :) Can
anyone tell us what the ViewState.Clear() does? Perhaps the Page_Load event
is not the place to issue that statement.
I just didn't want everyone to stop thinking. It is obvious that one
solution would be to clear the fields. Not sure I would want to use that
solution for my form that has 50 fields. ;)
Just my two cents,
Bob Lair
-----Original Message-----
From: Thomas Tomiczek [mailto:t.tomiczek@t...]
Sent: Thursday, April 26, 2001 4:08 AM
To: ASP+
Subject: [aspx] RE: How NOT to maintain a state of a form
Well,
then clear out the text boxes in the code that makes the database
insert. Thats simple, and the same model like with VB forms.
When you want the fields to clear up, clear them up.
Thomas Tomiczek
THONA Consulting Ltd.
-----Original Message-----
From: kamathamit@p... [mailto:kamathamit@p...]
Sent: Donnerstag, 26. April 2001 08:45
To: ASP+
Subject: [aspx] How NOT to maintain a state of a form
Hi,
I am developing an intranet application in which, after Form is
submitted ,in case it has errors the form is displayed again ( the state
is maintaine thanks to ASP+) but in case there are no errors the data
is
added to the Database ( Got this working too) & the same form is
displayed
again.
My problem is When the Form is Displayed again after a Succesful
entery
it shoul NOT maintain its state i.e. the textboxes should appear empty.
Amit Kamath
Message #8 by kamathamit@p... on Sat, 28 Apr 2001 10:14:59
|
|
Hi Juan,
Cant I goto control level to specify that a control should
maintain the state or not .. I read about this in .NET Help.. I wrote a
if condition in the control declation
i.e
<asp:Textbox ..
IF x=true then
.
.
Else
maintainstate=False
/>
I am not sure of the syntax now.. but the code ran without any problems
but DID NOT Yeild the Expected Response.
Amit Kamath
> Hi, Thomas.
>
> Uh, oh...
>
> In that case, it's hard to have your cake and eat it, too...;>)
> Either you maintain state or not maintain state.
>
> No halfway measures in state maintenance...
>
> Maybe, adding a button which links to a "clean" page
> ( identical to the one in which he's doing the operation
> except that it does NOT maintain state ), and which
> posts back to the original page, would be a workaround.
>
>
>
> Juan T. Llibre
> Microsoft MVP [IIS/ASP]
> ASP.Net En Espaņol : http://207.176.17.140/
> http://p2p.wrox.com/subscribe.asp?list=aspx_espanol
> http://www.asplists.com/asplists/aspnges.asp
> ==================================
|
|
 |