control state in

Control State in is client side state management technique.

Whenever we develop a custom control and want to preserve some information, we can use view state but suppose view state is disabled explicitly by the user, the control will not work as expected.

For expected results for the control we have to use Control State property.
Control state is separate from view state.

How to use control state property:

Control state implementation is simple. First override the OnInit() method of the control and add a call for the Page.

RegisterRequiresControlState() method with the instance of the control to register. Then override LoadControlState and SaveControlState in order to save the required state information.


Advantages of using control state in :

 No server resources are required:  By default, control state is stored in hidden fields on the page.

Reliability:   Because control state cannot be turned off like view state, control state is a more reliable method for managing the state of controls.

Versatility:   Custom adapters can be written to control how and where control-state data is stored.

Disadvantage of using control state in :

 Some programming is required:  

While the ASP.NET page framework provides a foundation for control state, control state is a custom state-persistence mechanism. To fully utilize control state, we must write code to save and load control state.