Why only specific controls are inherited from IPostBackDataHandler Interface in asp.net
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?.
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.
精彩评论