views:

46

answers:

1

In asp.net, how can I know which attributes are stored in ControlState and which in ViewState? Are there any official documents on this?

+1  A: 

I didn't see any public information about this, but you easily can find out this by yourself. Just dowlnoad Reflector, run it, select appropriate version of the framework (3.5 for example), click on search button, add methods selection (at the right of the search box) and type RegisterRequiresControlState - this method belongs to Page class, control needs to invoke this method to be (become? sorry for pidgin English) allowed to store data. After this doubleclick on the search result and the tree on the left will be expanded and this method will be selected. Right click on the method and select "Analyze". A new bar will be opened at the right. Expand "Used By" node and you'll get all controls which are using control state. Doublclick on the control you need, and select "SaveControlState" method of this control. Right click - disassemble. Voila, you'll see the source of this method and you'll see what exactly it stores in the CS.
Also you may search for "SaveControlState" method directly.
Reflector is free and it rocks.

zihotki