It's very true that Page's viewstate and Control's viewState is different. Consider and example. You need to store some data in view state. So you uses ViewState["somekey"] = "787878"; This value is no where related to your any of page's control. Another
way is you have value of text box which will be stored in ViewState. This control's view state will help to retain value in textbox even after postback. That's how both page and control viewstate are different. But remember both are stored only in one internal
hidden field control "__VIEWSTATE".
If you feel it helps, Mark as answered so that it can help others to find solution.
--Dhanraj Patil
Marked as answer by Qi Wu - MSFT on Feb 23, 2012 01:25 PM
vish02chouha...
Member
303 Points
251 Posts
confusion in view state
Feb 16, 2012 06:39 AM|LINK
Hi I am Reading this article on view state, and it tells that the view state of controls are different from the view state of page,
I think i am wrongly understand it or there is a different view state created for page and controls
DhanrajPatil
Member
186 Points
45 Posts
Re: confusion in view state
Feb 16, 2012 07:03 AM|LINK
It's very true that Page's viewstate and Control's viewState is different. Consider and example. You need to store some data in view state. So you uses ViewState["somekey"] = "787878"; This value is no where related to your any of page's control. Another way is you have value of text box which will be stored in ViewState. This control's view state will help to retain value in textbox even after postback. That's how both page and control viewstate are different. But remember both are stored only in one internal hidden field control "__VIEWSTATE".
--Dhanraj Patil
Richey
Contributor
3816 Points
431 Posts
Re: confusion in view state
Feb 22, 2012 08:39 AM|LINK
Hi,
You can find the different between page viewstate and control viewstate. You can refer to the below links.
http://weblogs.asp.net/ryangaraygay/archive/2008/05/08/page-viewstate-control-viewstate-and-controlstate.aspx
http://stackoverflow.com/questions/3020674/why-cant-i-access-page-viewstate-in-usercontrol
http://msdn.microsoft.com/en-us/library/1whwt1k7.aspx
roopeshreddy
All-Star
20155 Points
3328 Posts
Re: confusion in view state
Feb 22, 2012 02:05 PM|LINK
Hi,
Yeah! You can disable Page ViewState where as you cannot disable control state!
You can consider above user's explanation!
Hope it helps u...
Roopesh Reddy C
Roopesh's Space