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

Difference between DataGid and Girdview? Difference b/w .Net 2.0, 3.0 and 3.5 ? Diff b/w dispose & Finialize Methods?

2019


What is data caching?

547


What is the caspol.exe tool used for?

538


What’s the use of “GLOBAL.ASAX” file?

595


what are the web form events available in asp.net?

556






What is the application pool?

540


Differentiate globalization and localization.

582


Mention the execution process for managed code?

535


What is another word for redirect?

506


Define page output caching?

572


What is the difference between GridView and Repeater controls in ASP.NET?

575


What is the main difference between Asp.net and Vb.net?

562


Is sql backend or frontend?

553


What is ascx?

525


Describe the difference between inline and code behind - which is best in?

505