in my masterpage, I have a treeview control which contains many hyperlinks in hierarchical
structure. Due to that ViewState value become too large. I set EnableViewState property of Treeview to false, it decreases the viewstate size, but know Treeview Events such as collapsed, expand are not working.
my question is whether large viewstate value will affect the page performance like loading time ?
To disable view state for a page and to enable it for a specific control on the page, set the EnableViewState property of the page and the control to true, set the ViewStateMode property of the page
to Disabled, and set the ViewStateMode property of the control to Enabled.
The default value of the ViewStateMode property for a page is Enabled. The default value of the ViewStateMode property for a Web server control in a page is Inherit. As a result, if you do not set
this property at either the page or the control level, the value of the EnableViewState property determines view-state behavior.
The ViewStateMode property of a page or a control has an effect only if the EnableViewState property is set to true. If the EnableViewState property is set to false, view
state will be turned off even if theViewStateMode property is set to Enabled.
To disable view state for a page and to enable it for a specific control on the page, set the EnableViewState property of the page and the control to true, set the ViewStateMode property of the page to Disabled,
and set the ViewStateMode property of the control to Enabled.
I understand what you have mentioned but the large viewstate value is due to control i.e Treeview, which is in masterpage. The point is how to disable viewstate on that control without affecting the control events.
rajesh sahar...
Member
225 Points
554 Posts
will larger viewstate value reduces the page load time?
May 08, 2012 11:40 AM|LINK
Hi,
in my masterpage, I have a treeview control which contains many hyperlinks in hierarchical structure. Due to that ViewState value become too large. I set EnableViewState property of Treeview to false, it decreases the viewstate size, but know Treeview Events such as collapsed, expand are not working.
my question is whether large viewstate value will affect the page performance like loading time ?
Thanks
nijhawan.sau...
All-Star
16432 Points
3174 Posts
Re: will larger viewstate value reduces the page load time?
May 08, 2012 11:43 AM|LINK
Yes, as viewstate would be trasnferred b/w server and client on each postback.
rajesh sahar...
Member
225 Points
554 Posts
Re: will larger viewstate value reduces the page load time?
May 08, 2012 11:46 AM|LINK
Thanks
in my case how can i decrease the viewstate size ?
patuary
Member
425 Points
143 Posts
Re: will larger viewstate value reduces the page load time?
May 08, 2012 11:51 AM|LINK
u can set these properties at page tags
EnableViewState="false" ViewStateMode="Disabled"
nijhawan.sau...
All-Star
16432 Points
3174 Posts
Re: will larger viewstate value reduces the page load time?
May 08, 2012 11:58 AM|LINK
Just set EnableViewState="false" for all controls which donot require to maintain state b/w post backs.
rajesh sahar...
Member
225 Points
554 Posts
Re: will larger viewstate value reduces the page load time?
May 08, 2012 12:00 PM|LINK
where to set these properties.....MasterPage or child pages
rajesh sahar...
Member
225 Points
554 Posts
Re: will larger viewstate value reduces the page load time?
May 08, 2012 12:06 PM|LINK
Thats the problem, i am defining some events for Treeview, so that Treeview do not collapsed every time when we click on a link.
patuary
Member
425 Points
143 Posts
Re: will larger viewstate value reduces the page load time?
May 08, 2012 12:10 PM|LINK
at child pages.
As msdn on viewstate
To disable view state for a page and to enable it for a specific control on the page, set the EnableViewState property of the page and the control to true, set the ViewStateMode property of the page to Disabled, and set the ViewStateMode property of the control to Enabled.
The default value of the ViewStateMode property for a page is Enabled. The default value of the ViewStateMode property for a Web server control in a page is Inherit. As a result, if you do not set this property at either the page or the control level, the value of the EnableViewState property determines view-state behavior.
The ViewStateMode property of a page or a control has an effect only if the EnableViewState property is set to true. If the EnableViewState property is set to false, view state will be turned off even if theViewStateMode property is set to Enabled.
rajesh sahar...
Member
225 Points
554 Posts
Re: will larger viewstate value reduces the page load time?
May 08, 2012 12:29 PM|LINK
I understand what you have mentioned but the large viewstate value is due to control i.e Treeview, which is in masterpage. The point is how to disable viewstate on that control without affecting the control events.
Thanks
Srikanth Kas...
Contributor
4289 Points
883 Posts
Re: will larger viewstate value reduces the page load time?
May 08, 2012 01:29 PM|LINK
Rajesh,
If the Viewstates are heavy, i recommend you to go for some other state management techniques like Sessions..
Else.. compress the Viewstates..
http://www.codeproject.com/Articles/14733/ViewState-Compression
Srikanth Kasturi
Please "Mark As Answer" if my post serves purpose.