views:

37

answers:

1

Please tell me why some specific controls are inherited from IPostBackDataHandler interface (which maintains their state using HTTP Post header). and if state of controls like textbox are maintained by HTTP post headers then why they have property "View state" and what is use of it?.

+3  A: 

IPostBackDataHandler is used by input controls mostly, to access the POST data they generate. Controls such as labels don't generate any POST data keys of their own, so they don't use it.

Controls such as the TextBox use the view state to store things other than their value (enabled or not, maximum length, width, all the style properties, etc). Also, they use the viewstate to store their value when the control itself is invisible or otherwise not successful and its value will not get sent back by the browser.

Matti Virkkunen