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 *

9 + 5 =


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">