ASP.NET 2.0 control state vs ViewState

Is the new ControlState function only applicable to custom controls, or is it available for standard server controls?

This ... you can turn off the ViewState for the whole page with standard controls like Detailsview, Gridview and will it work? Does ControlState support standard server controls?

Or in order to work with ControlState for standard server controls, you need to change their behavior by creating a new custom GridView / DetailsView?

0


source to share


2 answers


From Microsoft Documentation .

Use control state only for small amounts of critical data that is necessary for control through postbacks. Don't use control state as an alternative to view.



From this you can guess that the GridView and other elements will not store this large amount of information in the ControlState, so my guess is that if you want to do this, then from the recommendation of Microsoft you will have to expand the base to do this.

+2


source


You can turn off view state for all pages, but you need to re-subordinate datagrid, dataview on every postback.

This sometimes works better than keeping a huge view on the client.



For standard server controls: if you change the Control Properties after init, all changes will be saved in the ViewState as well.

Here's a stunning Scott Mitchell Post on ViewState .

0


source







All Articles