Is there a way to make a variable global to an entire aspx file? I tried to just sticking it at the top where the declarations for the buttons ect go, but whenever I make changes to this variable they don't seem to stick. any ideas?
Printable View
Is there a way to make a variable global to an entire aspx file? I tried to just sticking it at the top where the declarations for the buttons ect go, but whenever I make changes to this variable they don't seem to stick. any ideas?
You can add variables to the viewstate. It has to be stored as a string and you must a have a <form runat="server"> on every page:-
ViewState("myvar") = "hello"
dim MyVar as string = cstr(ViewState("myvar"))
or for a number
ViewState("myint") = "10"
dim MyVar as string = int32.parse(ViewState("myvar"))