What is ViewState in ASP.Net?

ViewState in ASP.Net

  • ViewState is used to persist/Store the data on the single webpage.
  • If you want to store value on same page then and then you can use the ViewState.
  • we will not get ViewState value after the redirecting a webpage to another page.

    Synatax :- ViewState[“Name”]=”Value”;

    Example : –
    ViewState[“Name”]=”MeeraAcademy”;

    Retrieve the ViewState value:-

    str name;
    name=ViewState[“Name”].ToString();

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha *