Hi,

I am using the trace facility to find the viewstate size of controls on postback. I have added a label , a textbox and a submit button to the webform. However after posting my page and viewing the trace.axd page I find that the viewstate size bytes and controlstate size bytes is 0 for all the controls. Can anyone explain why ?

Regards

Sanjish

Recommended Answers

All 6 Replies

>Can anyone explain why ?

ViewState stores every changed property. Initializing the control in the page (any event) counts as a change, so any changes in control property during page execution will be persisted in viewstate.

But shouldn't the viewstate size bytes in trace.axd show some value atleast instead of 0 everytime i post ?

Regards

Sanjish

Add following in click handler of button,

TextBox1.BackColor=System.Drawing.Color.Red;
commented: Excellent explanation of the Query +4

Hi,
Thanks a lot for the explanation . It worked . However the control state size remains 0 . I am sure you can explain that also.

Thanks & regards

Sanjish

Thanks a lot for the links to control state . The articles have cleared my doubts about control state. Thanks once again

Regards

Sanjish

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.