what is view state and its use
Answers were Sorted based on User's Feedback
Answer / nageswara rao.g
viewstate is just like hidden field.Basically all html
controls are stateless .if u want maintain state for page
level we can use viewstate.
Is This Answer Correct ? | 25 Yes | 4 No |
Answer / chinnu
view state that automatically preserves property values of
the page and all the controls on it between round trips.
Is This Answer Correct ? | 22 Yes | 7 No |
Answer / rajesh
Actully All HTML controls are state-less ie;-these can not
store any type of clients inputs.when ever we send the page
to server it will send this page as fresh one.so we loose
the data what we have entered.
To store all these data (temporarly) in clients browsers ,
.Net provide a concept that is known as View state .View
state store the data in encoding format,so that one can not
gues it easily.
Is This Answer Correct ? | 22 Yes | 7 No |
Answer / namrata
In simple words........
(1)if you are not using viewstate: When a form is submitted
in ASP,all form values are cleared(get lost). For
example,If you submit a web form with lots of details and
the server comes back with an error.You will have to go
back to the form and correct the detail. Then You click the
back button to that same form, you will find that all form
values are CLEARED and you will have to start all over
again!
(2)if you are using viewstate: When a form is submitted in
ASP .NET, the form reappears in the browser window together
with all form values. This is because ASP .NET maintains
your ViewState. The ViewState indicates the status of the
page with all the values of controls on it when submitted
to the server.
Is This Answer Correct ? | 13 Yes | 3 No |
Answer / vijay
view state is used to find the current state of an object,
forexample with the help of view state we can find that
whether is a button is click or not;
Is This Answer Correct ? | 17 Yes | 10 No |
Answer / guest
View state .. the web is stateless when it is loaded.. so.
in view state . we can view in which suivation..
Is This Answer Correct ? | 7 Yes | 2 No |
Answer / rashmi thakur
ViewState is a built-in structure for automatically
retaining values among multiple requests for the same page.
The view state is internally maintained as a hidden field
on the page but is hashed, providing greater security than
developer-implemented hidden fields do.
Following are the benefits of using ViewState:-
 No server resources are required because state is
contained in a structure in the page code.
 Simplicity.
 States are retained automatically.
 The values in view state are hashed, compressed,
and encoded, thus representing a higher state of security
than hidden fields.
 ViewState is good for caching data in Web farm
configurations because the data is cached on the client.
Following are limitation of using ViewState:-
 Page loading and posting performance decreases when
large values are stored because
 View state is stored in the page.
 Although view state stores data in a hashed format,
it can still be tampered with because it is stored in a
hidden field on the page. The information in the hidden
field can also be seen if the page output source is viewed
directly, creating a potential security risk.
 If page get destroyed or refresh information which
is stored in view state gets vanished.
Below is sample of storing values in view state.
this.ViewState["EnterTime"] = DateTime.Now.ToString();
Is This Answer Correct ? | 11 Yes | 7 No |
Answer / karvendhan
view state that automatically preserves property values of
the page and all the controls on it between round trips.
Is This Answer Correct ? | 8 Yes | 6 No |
Answer / om nama shiva ya namaha
when ever any server control can raise its event then
browser can send its request to server and at the server
side the event executes and the response comes back to
browser is known as postback mechanism .During this postback
mechanism all the server controls data are stored in viewstate.
but for some controls like textbox,dropdown list,radiobutton
list etc can implement IPOSTBACK DATA HANDLERS interface for
this controls even if we put enableviewstate to false.these
controls can store all the data in html bodys .Even if we
disable viewstate they maintain data in the controls
Is This Answer Correct ? | 7 Yes | 5 No |
Answer / vaithianathan
hi, rajesh..
i am learning asp.net... actually, i dont know whether ur answer is correct or not.. but ur explanation is simply superb and easy to understand..
Is This Answer Correct ? | 4 Yes | 2 No |
What is meant by web application?
What do you understand from custom control?
What is simple data binding?
Give some salient points of difference between request processor and request dispatcher.
What is shadowing?
What is Assert Method ?
What is Boxing and Unboxing?
7 Answers Accenture, IBM, Tech Mahindra,
I have created a configuration setting in my web.config and have kept it at the root level. How do I prevent it from being overridden by another web.config that appears lower in the hierarchy?
Is data edited in the Repeater control?
What is the asp.net control toolkit?
Which validator control you use if you need to make sure the values in two different controls matched?
What are themes and skins in 2.0, explain usage scenario?