G
Guest
Yes, the myVar fields is store anywhere, and so it's lost between two
postbacks.
You must save it in the viewstate as following :
protected int MyVar
{
get
{
object o = ViewState["MyVar"];
if ( o != null )
return (string) o;
return "Default Value";
}
set
{
ViewState["MyVar] = value;
}
}
postbacks.
You must save it in the viewstate as following :
protected int MyVar
{
get
{
object o = ViewState["MyVar"];
if ( o != null )
return (string) o;
return "Default Value";
}
set
{
ViewState["MyVar] = value;
}
}