470,614 Members | 1,578 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,614 developers. It's quick & easy.

How view state is maintaing in asp.net

Hi all,

I am new to asp.net. I am not very much clear in concept of
viewstate.

CAn anyone help me in understanding this concept. I have one question
regarding viewstate.

I have one aspx page with enableviewstate property set to true. So
when i run my application in
in html code of page i found _viewstate with some value.

My question is how server preserver viewstate between two page
request. Means next time when i send request for same page how it will
load content from previous viewstart.

Any help will be truely appreciated.

Mar 2 '07 #1
2 1474
Look at the viewstate as a "property bag" where you can place hidden
variables. In the old days of ASP, if you wanted to remember info between
page requests that wasn't contained in a visible form element, you had to
store it in a HIDDEN field. The viewstate is just asp.net taking control of
these hidden fields. Rather than creating lots of them, it encodes them all
into one big variable.

When your page is rendered, the state of each control (eg if a dropdown
list, all of the list items) is encoded into the viewstate. On a PostBack,
this variable is read from the form and decoded to preserve the state of any
controls you had etc.

"archana" <tr**************@yahoo.comwrote in message
news:11**********************@t69g2000cwt.googlegr oups.com...
Hi all,

I am new to asp.net. I am not very much clear in concept of
viewstate.

CAn anyone help me in understanding this concept. I have one question
regarding viewstate.

I have one aspx page with enableviewstate property set to true. So
when i run my application in
in html code of page i found _viewstate with some value.

My question is how server preserver viewstate between two page
request. Means next time when i send request for same page how it will
load content from previous viewstart.

Any help will be truely appreciated.

Mar 2 '07 #2
"Aidy" <ai**@noemail.xxxa.comwrote in message
news:sf******************************@bt.com...
When your page is rendered, the state of each control (eg if a dropdown
list, all of the list items) is encoded into the viewstate. On a
PostBack, this variable is read from the form and decoded to preserve the
state of any controls you had etc.
Mostly, but extra coding is required for controls such as <asp:ListBox>
etc...
http://www.thescripts.com/forum/thread566476.html
Mar 2 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.