Tuesday 17 July 2012

View State in ASP.NET

The load view state stage only happens when the page has been posted back. During this stage, the view state data that had been saved from the previous page visit is loaded and recursively populated into the control hierarchy of the Page. It is during this stage that the view state is validated. As we'll discuss later in this article, the view state can become invalid due to a number of reasons, such as view state tampering, and injecting dynamic controls into the middle of the control hierarchy.

Example:-

ViewState["UserName"] = "MYK";

You have to take care of conversion of view state value when using with different type of data types

No comments:

Post a Comment