Explian about the view state?


View State is a built in feature in web controls to persist data between page post backs.By default,Each control's of EnableViewState property will be set to true.so that we can disable the viewstate for the controls which we don't want to maintain state.
We can also disable View State for the entire page by adding EnableViewState=false to @page directive.View state data is encoded as binary Base64 - encoded which adds overhead to the page.This will be the disadvantage of the viewstate.

we can also store specfic data across the postbacks.

ex:
// Add item to ViewState
ViewState["state"]  = someValue;
//Reading items from ViewState
Response.Write(ViewState["state"]);

No comments:

Post a Comment