I have a page with a few textboxes. When the page is posted, the textfields
retain their values even though I have viewstate turned off. It's turned
off in 2 different places.
- The control itself.
- Page.EnableViewState = false; in page_load.
How do I get the textboxes cleared after a postback without clearning them
programmatically?
J.On Wed, 7 Jul 2004 10:50:50 -0700, John Dalberg <john_dd@.hotmail.com>
wrote:
> I have a page with a few textboxes. When the page is posted, the
> textfields
> retain their values even though I have viewstate turned off. It's turned
> off in 2 different places.
> - The control itself.
> - Page.EnableViewState = false; in page_load.
> How do I get the textboxes cleared after a postback without clearning
> them
> programmatically?
> J.
They get automatically populated with the forms' POST values. ViewState
only stores what .NET can't get from the POST data.
Don't know how to do this w/out programmatically clearing them, outside of
using some JS on the client side. Perhaps someone else knows of a
workaround...
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Textboxes don't use viewstate to retain their value property.
Standard HTML provides a value property for textboxes so this is what
ASP.NET uses in this case.
Assuming your textboxes start out blank initially, you could try code like
this to get the page to forget its values:
Response.Redirect(".")
The idea is that you are not posting back to your page, you are requesting a
fresh copy.
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"John Dalberg" <john_dd@.hotmail.com> wrote in message
news:19unsgtg2xf6x.181667quuc0kg.dlg@.40tude.net...
> I have a page with a few textboxes. When the page is posted, the
textfields
> retain their values even though I have viewstate turned off. It's turned
> off in 2 different places.
> - The control itself.
> - Page.EnableViewState = false; in page_load.
> How do I get the textboxes cleared after a postback without clearning them
> programmatically?
> J.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment