views:

1562

answers:

2

Is the new ControlState feature only applicable to custom controls or is it available for the standard server controls as well?

That is..can you disable ViewState for an entire page with standard controls like Detailsview, Gridview and would it still work? Does ControlState apply to standard server controls?

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

+2  A: 

From the Microsoft Documentation.

Use control state only for small amounts of critical data that are essential for the control across postbacks. Do not use control state as an alternative to view state.

From this you can guess that GridView and other items would not be storing that large of an amount of information in ControlState, so I'm guessing that if you wanted to do it, against Microsoft's recommendation you would have to extend the base control to do it.

Mitchel Sellers
Michael, thanks for your reply but this does not exactly answer my question.
cwius
If you disable viewstate, grid view and other items will NOT function, as the data that is bound to them is not a critical amount of data.
Mitchel Sellers
A: 

You can disable viewState for all page but you need to rebind datagreed, dataview.... on every postback. Sometimes it works better then savint huge viewstate on the client.

For Standard server controls: If you modify Control Properties after init then all modifications will be saved in ViewState too.

Here is awesome Scott Mitchell Post about ViewState.

Danil