Personal Web & Sample Site
Skip Navigation Links
HOME |
About Me |
Articles
| Contact Us
Control State
Rating: 12 user(s) have rated this article Average rating: 5.0
Posted by: joet, on 9/27/2011, in category "ASP.NET"
Views: this article has been read 2105 times
Location: United States
Abstract: So, we know what View State is and the disadvantage in using it. Control State was created in the new ASP.NET 2.0 to overcome that disadvantage.

 

ASP.NET 2.0 introduces a new type of state called Control State, which is a similar to view state, except that it's only related to a particular control and it can't be disabled. Values that a control wants to save across postbacks can be saved in the control state, while values  that are not strictly necessary can go into the view state.

Control state survives even if the developer using the custom control disables view state. The advantage is pretty obvious; in prior versions of Visual Studio, the consumer of a custom control could disable view state; if the control relied on view state to maintain state information, the control would cease to function or at least misbehave. Creating control state removed the ability of another developer to disable view state based state management within the control; naturally, the control designer may still opt to not use either view state or control state based state management.

This is important information because it's the bases for pulling properties out of many of the custom controls I've added to the web site, in particular the User Profile control.


How would you rate this article?

User Feedback

Post your comment
Name:
E-mail:
Comment:
Insert Cancel

Copyright © 2013 Jose M. Tamez
Last Updated August 18th 2013