home / software / tips and tricks / How to add Items ViewState ?

How to add Items ViewState ?

Updated:  02/15/2009 08:02 AM
Author:  Shiju Mathews

Status:    Resolved.

ASP.NET uses the ViewState to store data going back and forth to the server, eliminating the manual drudgery of reloading form controls and so forth. The ViewState can also be helpful for keeping your own state information, once you know how to read and write it. Using the ViewState can also eliminate nearly every case in which you would have used a hidden input field, a cookie, or a query string variable to pass information. It simply provides a cleaner way to pass your own information while your page is running. This ViewState property is restricted to current pages only.

In a page I want to add boolean a variable "ActionPhone" to view state. We can add this to to viewstae in one of the lifecycle of the page that should fire before the usage of this ViewState property.

This ViewState property can be accessed like this

Tags: How to add Items ViewState ?
Updated on: October 2023