What is view state?

Answers were Sorted based on User's Feedback

What is view state?..

Answer / prashant

ViewState is the mechanism ASP.NET uses to keep track of
server control state values that don’t otherwise post back
as part of the HTTP form. ViewState Maintains the UI State
of a Page
ViewState is base64-encoded. It is not encrypted but it can
be encrypted by setting EnableViewStatMAC=”true” & setting
the machineKey validation type to 3DES. If you want to NOT
maintain the ViewState, include the directive < %@ Page
EnableViewState="false" % > at the top of an .aspx page or
add the attribute EnableViewState=”false” to any control.

Is This Answer Correct ?    11 Yes 0 No

What is view state?..

Answer / jeyaseelan

view state is nothing but store all the current page
informations and the control details when the page is
postback.all the control details and values to be stored in
hidden field.Those hidden fields are creating dynamically
depending upon the page placed controls.If you want to
fetch the values of the previous page control(ex:'Name' is
the previous page control Id)

Get the value of name from second page

sample code:

string get_Name=viewstate["Name"].Tostring();

Is This Answer Correct ?    5 Yes 0 No

What is view state?..

Answer / suhasini suresh

The load view state stage only happens when the page has
been posted back. During this stage, the view state data
that had been saved from the previous page visit is loaded
and recursively populated into the control hierarchy of the
Page. It is during this stage that the view state is
validated. The view state can become invalid due to a
number of reasons, such as view state tampering, and
injecting dynamic controls into the middle of the control

Is This Answer Correct ?    5 Yes 1 No

What is view state?..

Answer / aravind

*Viewstate object is used to persist data of variables
across postbacks.
*Viewstate object's value is accessible only at page level.
*This means that if a viewstate is created at MyPage.aspx,
then it may be used only within MyPage.aspx after the
postback, and cannot be used by any other page.

Is This Answer Correct ?    2 Yes 0 No

What is view state?..

Answer / santosh kakani

ViewState is used to maintain state between 2 subsequent
resuests to same page by same client

int i=10

ViewState.add("key",i) // here i is value

to retrive view state

int j = Convert.toInt32(ViewState["key"]);

Is This Answer Correct ?    0 Yes 0 No

What is view state?..

Answer / sheeladanduboyina

ViewState is built in structure for automatically retaining the multiple requests for the same page. All the data in View State is stored in the form of the Base 64 Algorithm in thehidden field as string. Its the matter of Encryption ,Decrption in storing the data in the ViewState

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Dot Net General Interview Questions

1 mor thing guyz....can i go for C# directly without C++ /JAVA knowledge for dot net ..???

3 Answers  

what is use of learning .net? does we get good jobs based on .net?

2 Answers  

How can you automatically generate interface for the remotable object in .NET with Microsoft tools?

1 Answers  

What is the raise event used for?

4 Answers   Wipro,

What are server controls?

1 Answers   Wipro, Avanade,

Difference b/w dataset.clone and dataset.copy ?

1 Answers   Protech,

What is different between User Control and Web Control and Custom Control?

2 Answers  

What is RunTime Polymorphism?

5 Answers   Intel, eClerx, Deloitte, Horizon, Pragna Technologies,

How do you start, pause, continue or stop a Windows service off the command line?

1 Answers  

When developing a Windows service for .NET, which namespace do you typically look in for required classes?

1 Answers  

syntax for binding the data from database

1 Answers   Satyam,

Write an StoredProcedure to get the values of a column within a date range.

1 Answers   Deloitte,

  • Dot Net Framework Interview Questions Dot Net Framework (298)
  • Dot Net Remoting Interview Questions Dot Net Remoting (75)
  • Dot Net WindowsForms Interview Questions Dot Net WindowsForms (83)
  • Dot Net General Interview Questions Dot Net General (324)
  • Dot Net AllOther Interview Questions Dot Net AllOther (179)