Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with variable
Message
From
13/09/2006 11:58:49
 
 
To
13/09/2006 02:05:29
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
MS SQL Server
Miscellaneous
Thread ID:
01152158
Message ID:
01153387
Views:
26
This message has been marked as the solution to the initial question of the thread.
The problem is because web pages are stateless. Your variable gets re-set back to it's original value with every post-back. This is normal behavior. After you set your variable in your addRecord method, you need to save it into a Session object so that it's persisted between post-backs.

~~Bonnie


>Hi Chad, sorry for confusing you.
>
>What I want is the addRecord calls whenever the page is NOT post back, else it will do other functions. The function called has no problem, and the value has been set as expected after the page load (without any user's action). I'm just confused that why the variable becomes NULL when I click a button to retrieve it's value which has been set in the Page Load function, thanks.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform