Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Variables getting reset
Message
Information générale
Forum:
ASP.NET
Catégorie:
Migration
Divers
Thread ID:
00681367
Message ID:
00681415
Vues:
17
>>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]
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform