Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to set a private variable?
Message
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
How to set a private variable?
Environment versions
Environment:
C# 2.0
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01344645
Message ID:
01344645
Views:
59
Hi,

The title is not very clear so I will have to explain what I am trying to do.

I have a form where I need to get/read a value of a Private string variable in Submit method. But the value to this private string variable is assigned in a MyTextField_TextChanged method. Here are the steps:

ASP.NET form has a textbox that has a method MyTextField_TextChanged. User enters value in this textbox. In the MyTextField_TextChanged the program get some value from the database and assigns this value to a Private string variable. The value is set but then "lost" as soon as program returns focus back to the form. I thought initially that since both Submit method and MyTextField_TextChanged belong to the same class the value in the private variable will be "visible" but it does not work that way.

Therefore, when user clicks on Submit the Submit method sees value in this variable as empty string.

The only way I see possible doing it is via session variables. But is there another method?

Thank you in advance for any suggestions.
"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
Next
Reply
Map
View

Click here to load this message in the networking platform