Controlstate confusion

R

r.vries

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

r.vries

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

Teemu Keiski

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

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,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top