Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to set a private variable?
Message
 
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 2.0
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01344645
Message ID:
01344802
Views:
9
>>>>>If there is a postback between receiving this variable and retriving it, then it would be lost and you need to save it either in ViewState or in Session or in Cockie. Otherwise you can use a class variable declared on the class level.
>>>>
>>>>I ended up using Session variable. So far, in my testing, it works. I sent update to the customer for testing too.
>>>
>>>Hi,
>>>Session would work but since it's just a simple string variable and is page specific using ViewState might be a better choice in this case.
>>>Regards,
>>>Viv
>>
>>Thank you, Viv.
>>
>>I have to look into how to accomplish the same as thing as with Session using ViewState (I have not done work in ASP.NET for a long time).
>
>Pretty straightforward. To save:
>ViewState["myVariable"] = myVariable;
>To retrieve:
>myVariable = ViewState["myVariable"];

Thank you. It could not be simpler.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform