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



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

Answer / 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

More ASP.NET Interview Questions

What is advantage of code behind coding in ASP.NET?

0 Answers   Sans Pareil IT Services,


Explain how do you validate the controls in an asp .net page?

0 Answers  


what is client-server architecture in .net? and what is 3-tier architecture?

1 Answers  


Explain the difference between AutoPostBack and IspostBack in ASP.NET?

0 Answers   Sans Pareil IT Services,


What are the advantages and limitations of query string?

0 Answers  






Is it possible to add aspx.vb file in to C# Web Project? If so how can i use the vb file in the C# Web project?

3 Answers  


What is http protocol and how it works?

0 Answers  


What do you mean by authentication?

0 Answers  


3. What goals do you have in your career?

0 Answers   Swatz Oils,


You create an ASP.NET application for a hotel. The application contains a page that displays current weather conditions for the city in which the hotel is located. The application calls an XML Web service every 10 minutes to update the current weather conditions. A new page is then displayed for subsequent requests. You want the same page to be cached and retrieved from the cache during the time between calls to the XML Web service. You decide to use a Page directive to accomplish this goal. Which Page directive should you use? A . <%@ Cache Seconds="600 '' VaryByParam="Page" %> B . <%@ OutputCache Time="600" %> C . <%@ OutputCache Duration="600" VaryByParam="None" %> D . <%@ OutputCache Duration="600" %>

2 Answers   Syntax Softtech,


How we implement web farm and web garden concept in asp.net?

0 Answers  


How do you add a javascript function for a link button in a datagrid ?

4 Answers   Microsoft,


Categories