How to ignore postback values?

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.
 
H

Hans Kesting

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top