27
Dec:How will you apply view state at page level as well as at control level?
0 Comments | Posted by muskanpatil in Asp.Net
· Viewstate is one of the most important and useful client side state management mechanisms.
· It can store the page value at the time of post back of your page.
· ASP.NET pages provide the View State property as a built-in structure for automatically storing values between multiple requests for the same page.
· There are two level of view state:
1. Page level
2. Control level
· Page Level view state control treat as highest priorities.
· Which means If we set EnableViewState= “False” in page level, that will automatically be derived by all the server side controls. In that case, if we set EnableViewState=”True” for any server side control will treat it as false, as we have defined them “False” in Page Level.
· Apply the view state at page level:
o Page level means apply viewstate property to page.
o To apply the viewstate at page level set the property EnableViewState of page
o Now , if set the EnbleViewState property = “true” then all the server control derived this property as true.
o If we set the EnbleViewState property = “false” then all the server control derived this property as false.
· Apply the view state at control level:
o Control level means apply viewstate property on controls used in page.
o To apply the viewstate at control level then set the enableviewstate property of each control on which you want to set.
o Ex. <asp:DropDownList ID=”DropDownList1″ runat=”server” EnableViewState=”true”> </asp:DropDownList>
o If you apply page level as false then this property will not work because pagelevel has high priority.
![[del.icio.us]](http://www.itshala.com/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://www.itshala.com/wp-content/plugins/bookmarkify/digg.png)
![[dzone]](http://www.itshala.com/wp-content/plugins/bookmarkify/dzone.png)
![[Facebook]](http://www.itshala.com/wp-content/plugins/bookmarkify/facebook.png)
![[Google]](http://www.itshala.com/wp-content/plugins/bookmarkify/google.png)
![[LinkedIn]](http://www.itshala.com/wp-content/plugins/bookmarkify/linkedin.png)
![[Twitter]](http://www.itshala.com/wp-content/plugins/bookmarkify/twitter.png)
![[Windows Live]](http://www.itshala.com/wp-content/plugins/bookmarkify/windowslive.png)
![[Yahoo!]](http://www.itshala.com/wp-content/plugins/bookmarkify/yahoo.png)
![[Email]](http://www.itshala.com/wp-content/plugins/bookmarkify/email.png)
