ViewState not working

Results 1 to 2 of 2

Thread: ViewState not working

  1. #1
    Join Date
    Dec 1969

    Default ViewState not working

    I am pretty new to ASP.NET. I have been trying for quite some time to get ViewState to work in my applications. If I just want to get a textbox to keep the value when I go to another page and return or if I just refresh the page. How do I go about doing that? Do I need to do any coding or is it enough if I click on enable viewstate in Visual Studio .NET for the textbox (and maybe for the document)? Anyway, I've of course tried this, but it is not working.

  2. #2
    Join Date
    Dec 1969

    Default RE: ViewState not working

    ViewState is specific to each individual page, and is specific to PostBacks to that page. Meaning that if you have page1.aspx and page2.aspx you cannot* share ViewState between them. If you have a textbox and a button on page1.aspx, type a value into the textbox and click the button. The textbox value should stay after the page reloads (does its PostBack).<BR><BR>Technically, ViewState is a hidden form field that stores page state information. ViewState stores nothing on the server. Nothing.<BR><BR>* I have heard that if you use Server.Transfer some or all of the information from the start page is bundled up and transfered to the destination page you are doing the Server.Transfer to.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts