Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clearing text box 1

Status
Not open for further replies.

JJ297

Programmer
Jun 27, 2007
30
0
0
US
Could someone tell me how do I clear the text box after hitting the submit button? I have the page posting back to itself.
 
another, more complex option, disable viewstate.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
I don't think that would work Jason, as ViewState isn't responsible for repopulating these control values (that would be the job of the LoadPostData method).


-------------------------------------------------------

Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions
[URL unfurl="true"]http://weblogs.asp.net/marksmith[/url]
 
i thought viewstate was responsible for presisting these through postbacks. it's been my experience that when setting the viewstate of a control to false the values are not persisted between postbacks.

I won't digress the thread anymore, use Mark's suggestion it's simple easy and effective:)

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Jason,

No, ViewState is just actually responsible for remembering the dynamically populated items of controls. The actual values are not the responsibility of ViewState:

MSDN said:
It is a common misconception among developers that view state is somehow responsible for having TextBoxes, CheckBoxes, DropDownLists, and other Web controls remember their values across postback. This is not the case, as the values are identified via posted back form field values, and assigned in the LoadPostData() method for those controls that implement IPostBackDataHandler.


-------------------------------------------------------

Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions
[URL unfurl="true"]http://weblogs.asp.net/marksmith[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top