Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Why textbox is persisted when viewstate is off?

Reply
Thread Tools

Why textbox is persisted when viewstate is off?

 
 
John Dalberg
Guest
Posts: n/a
 
      07-07-2004

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.
 
Reply With Quote
 
 
 
 
Craig Deelsnyder
Guest
Posts: n/a
 
      07-07-2004
On Wed, 7 Jul 2004 10:50:50 -0700, John Dalberg <(E-Mail Removed)>
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
 
Reply With Quote
 
 
 
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      07-07-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> 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.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
Dataset not persisted on PostBack VB Programmer ASP .Net 2 06-06-2004 03:36 PM
State Persisted Without Session or Application -- Why ? Anthony P. Mancini ASP .Net 8 05-08-2004 02:36 PM
How do you save persisted (between runs) login information in .NET (c#)? Tom Jorgenson ASP .Net 0 07-17-2003 04:46 PM
style.display setting not persisted in viewstate Toby Mills ASP .Net 0 06-24-2003 01:55 PM



Advertisments