Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Variables getting reset
Message
General information
Forum:
ASP.NET
Category:
Migration
Miscellaneous
Thread ID:
00681367
Message ID:
00681415
Views:
16
>>On a web form, I declare a vairable (int) in the class of the form which I intend to use at various places in the code-behind. For example, a primary key that may be used for a data action in one or more places. The variable gets populated early in the page_load event. However, each time a postback happens, the variable gets reset to zero. I can re-establish it on postback which seems redundant, or I can declare it static initially (either private or protected), and then it holds its value. Declaring it as a static is the easiest, but that doesn't seem like the right solution as I understand the definition of static.
>>
>>Am I on the right track here, or is there a better way to get the variable to persist.
>>
>>Dick Harrold
>
>viewstate

David,

Thanks, I'll give the viewstate a try.

Dick Harrold
=========================================
Dick Harrold [DickHarrold@Yahoo.com]
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform