Controlstate confusion

Discussion in 'ASP .Net Building Controls' started by r.vries, Dec 26, 2007.

  1. r.vries

    r.vries Guest

    Hi,

    I'm just starting with asp.net and created a toolbar (custom) control.

    Everything works fine but when I do a postback a pushed button gets
    'the 'unpushed' state...

    I'm using LoadControlState and SaveControlState but the events aren't
    fired in the order I thought they would.

    Postback occured
    -LoadControlState fired
    -SaveControlState fired

    This explains why my button loses its state after a postback.

    But why is the state loaded before it is saved?

    Best regards,
    Ron
     
    r.vries, Dec 26, 2007
    #1
    1. Advertisements

  2. r.vries

    r.vries Guest

    ps. I solved 'the pushed button' issue with a hidden field, so I'm not
    looking for a solution. :)
    But I'm just a bit confused by the behaviour of saving and loading the
    controlstate.
     
    r.vries, Dec 26, 2007
    #2
    1. Advertisements

  3. r.vries

    Teemu Keiski Guest

    Hi,

    control state is saved initially on the first request when you load the
    page. Then on postback, it is first loaded back (on the server) , used in
    the process of dealing with the request (in respect to the control), and
    then again finally saved for the next postback (containing possible
    changes).
     
    Teemu Keiski, Jan 14, 2008
    #3
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.