How to ignore postback values?

  • Thread starter Thread starter Bob Owens
  • Start date Start date
B

Bob Owens

Hi all,

I have an html form (generated by asp.net of course) with several
DropDowns and text boxes on it. I'd like to handle things such that
every time the form is posted back this information is saved (to a
database in my case, but that's not important here) and the various asp
elements are reset to their "default" values. In other words I don't
want the controls to keep their postback values.

Instead, they're in "Night of the Living Dead" mode. They keep coming
back with these postback values no matter what.

How can I force my controls to forget their previous state? I've
disabled the enableviewstate property on some of them, only to learn
that the viewstate is _not_ responsible for these things retaining
their values on postback.
 
Bob said:
Hi all,

I have an html form (generated by asp.net of course) with several
DropDowns and text boxes on it. I'd like to handle things such that
every time the form is posted back this information is saved (to a
database in my case, but that's not important here) and the various
asp elements are reset to their "default" values. In other words I
don't want the controls to keep their postback values.

Instead, they're in "Night of the Living Dead" mode. They keep coming
back with these postback values no matter what.

How can I force my controls to forget their previous state? I've
disabled the enableviewstate property on some of them, only to learn
that the viewstate is _not_ responsible for these things retaining
their values on postback.

If you redirect (to this same page) after you have saved all values, you
solve several things:
1) you remove the "ispostback", so all fields are initialized fresh
2) if the user refreshes the page, you don't save a second copy of the previous data
and the user doesn't get that "POST" warning.

Hans Kesting
 
Back
Top