Visit atmiya university website : www.atmiyauni.ac.in
For Admission: http://admission.atmiya.ac.in
Contact No: 9099076112/7874745726
This video is about how can we store page-level state or information using view state.
▪ You can preserve the state of the application either at the server or the client's end.
▪ The state of a web application helps you to store the runtime changes that have been made to the web application.
▪ For example, a user selects and saves some products in the shopping cart of online shopping websites.
▪ For that you have to store it to state, otherwise, the changes are discarded.
Page-Level State [View State]
▪ In Asp.Net, the ViewState property is used to store the page-level state of a web page, the ViewState property the state information of a single user, as long as the user is working with the page.
▪ The ViewState property is used when a form is submitted and presented a second time to a user, as it retains the information entered in the form’s controls first time.
▪ The ViewState property at each page is initialized and stored in ViewState.
▪ The string is assigned to the Value attribute of ViewState field and is sent as a part of the web page.
Syntax :
ViewState[“UserdefinedKey”] = user defined value;
Response. Write(ViewState[“userDefinedKey”]);