How are you maintaining the value? Are you putting it into viewstate or
anything like that? If I were you, I'd try placing the value into viewstate
in the page_render function and I'd read it from viewstate during page_init.
If the page_init is empty, you'll have to load it..
I code in c#, but maybe vb is similar...
CurrentStatus = ViewState("CurrentStatus")
If Page.IsPostBack Then
If CurrentStatus <> 1 Or CurrentStatus <> 2 Then
'you need to reload it...
End If
End If
Or something like that...
and to save it...
ViewState("CurrentStatus") = CurrentStatus
I'm guessing vb still uses () in c# it's []
ViewState["CurrentStatus"]
Sooo
int CurrentStatus = Convert.ToInt32(ViewState["CurrentStatus"]);
if (CurrentStatus != 1 || CurrentStatus !=2)
{
// currentstatus is invalid
}
"Big E" <no****@nospam.com> wrote in message
news:ec**************@TK2MSFTNGP11.phx.gbl...
I'm using ASP.net and SQL Server.
I declare a Public Variable. I then set it depending on a if then else
statement below. My problem is because of the various round trips to the
server I lose the value of that variable by the time I need it.
Public CurrentStatus As Integer HERE IS WHERE I SET IT
If dtRealtor.Rows.Count <> 0 Then HERE IS WHERE I GIVE IT SOMETHING
CurrentStatus = 1
Else
CurrentStatus = 2
End If
Then when I call its value it equals 0 and I think its because of the
server round trips 0 it out.
Thank you,
Big E