What is view state? where it stored? can we disable it ?

Answer Posted / madhuri kumari

The web is state-less protocol, so the page gets instantiated, executed, rendered and then disposed on every round trip to the server. The developers code to add "statefulness" to the page by using Server-side storage for the state or posting the page to itself. When require to persist and read the data in control on webform, developer had to read the values and store them in hidden variable (in the form), which were then used to restore the values. With advent of .NET framework, ASP.NET came up with ViewState mechanism, which tracks the data values of server controls on ASP.NET webform. In effect,ViewState can be viewed as "hidden variable managed by ASP.NET framework!". When ASP.NET page is executed, data values from all server controls on page are collected and encoded as single string, which then assigned to page's hidden atrribute "< input type=hidden >", that is part of page sent to the client.
ViewState value is temporarily saved in the client's browser.ViewState can be disabled for a single control, for an entire page orfor an entire web application. The syntax is:
Disable ViewState for control (Datagrid in this example)
< asp:datagrid EnableViewState="false" ... / >
Disable ViewState for a page, using Page directive
< %@ Page EnableViewState="False" ... % >
Disable ViewState for application through entry in web.config
< Pages EnableViewState="false" ... / >

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is LINQ performance wise better or using sqlcommand?

4338


Differentiate between globalization and localization.

540


how to debug web services on consumer side?

582


How to disable validator control by client side JavaScript?

575


If you want to write your own dot net language, what steps you will you take care?

527






Disable browser cache for entire ASP.NET website?

671


How will you do Redo and Undo in a TextControl?

674


Define the types of configuration files.

536


What is asp.net response object?

564


If you are using components in your application, how can you handle exceptions raised in a component?

2083


What is different in .net 1.1 and .net 2.0?

578


Explain the difference between authentication and authorization.

601


Is asp.net a programming language or framework?

556


What is difference between or and orelse?

551


Which of the following .NET framework supports Web API?

645