Search code examples
asp.netsessionviewstateautopostbackispostback

Using ViewState variables


I want to use viewstate variable's value which is saved in one page on another page. But while doing so it shows NullReferenceException. I am new to ASP.net. Please Help me out.

in register.aspx

ViewState("name")=textbox1.text

in success.aspx

dim a as string

a=ViewState("name").toString


Solution

  • Use Session["name"] = textbox1.text...

    If I am not mistaken, you don't have direct control or should have direct control over viewstate.