What is the c#asp.net viewsatate

Questions by selvalpt

Showing Answers 1 - 5 of 5 Answers

aa

  • Mar 28th, 2006
 

Its enable to store value of the form before postback

  Was this answer useful?  Yes

sumalatha

  • Mar 29th, 2006
 

view state is working on page level only. whenever the page is postback then the view state value will be loss

  Was this answer useful?  Yes

ViewState is nothing but the state of the controls and the page itself at the time of submission.
When page is submitted, state of all the controls (all the property values) is stored in the form of a encrypted string in the hidden field on the page; and when page is reloaded, the control's properties are restored from the ViewState and rendered.

LoadViewState() and SaveViewState() are the functions that are called during saving and retriving the viewstate.

Thanks,

Vikram

  Was this answer useful?  Yes

kumud

  • Apr 12th, 2006
 

view state is property of page to retain the value of control used in page within a roundtrip.

  Was this answer useful?  Yes

thrusty_programmer

  • May 23rd, 2006
 

When you go away from your house , you lock it . When you return after opening the lock you see that all the things are in same place where you left them before leaving, same is done by the viewstate it keep all the controls in the same state(all properties) where you left them before submission(postback), ASP.net does it by adding a hidden field to the webform, which contains the state values of the form and all it's controls.

you can illustrate it by an example:

Take a server control (textbox)add it to your webform and a html textbox add it to your webform. and a server button .

Run the webform ,write some text to each of the textbox then press submit button you will see that value in the server textbox doesnot change where as html textbox become blank , it happen's because the server textbox contains the viewstate hence it's value remain intact.

I hope that I had cleared your doubt to some extent.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions