How to ignore postback values?

Discussion in 'ASP .Net' started by Bob Owens, Dec 28, 2004.

  1. Bob Owens

    Bob Owens Guest

    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 Owens, Dec 28, 2004
    #1
    1. Advertising

  2. Viewstate is not the only source of data for controls. Have a look at
    http://blogs.aspadvice.com/joteke/archive/2004/03/15/767.aspx

    Eliyahu

    "Bob Owens" <> wrote in message
    news:...
    > 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.
    >
     
    Eliyahu Goldin, Dec 28, 2004
    #2
    1. Advertising

  3. Bob Owens

    Hans Kesting Guest

    Bob Owens wrote:
    > 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
     
    Hans Kesting, Dec 28, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Piotrek \Alchemik\
    Replies:
    0
    Views:
    318
    Piotrek \Alchemik\
    Nov 12, 2006
  2. Replies:
    4
    Views:
    439
  3. Travis Kirstine

    python image - ignore values in resize

    Travis Kirstine, Mar 6, 2009, in forum: Python
    Replies:
    1
    Views:
    310
    Lie Ryan
    Mar 7, 2009
  4. how to ignore postback data in particular situations

    , Nov 15, 2008, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    838
  5. Rob Meade
    Replies:
    6
    Views:
    300
    Rob Meade
    Mar 1, 2004
Loading...

Share This Page