ASP.NET variable scope
- by c11ada
hey all,
im really new to ASP.Net and still havnt got my head round most of the concepts, im really having problems with variable, when creating a desktop application, any variable created in code for example
int n = 10;
this variable will be there until the program is running right. but in asp iv created variables which are supposed to last until the user gets of that page, so for example say i have a page which takes the users value ( call this variable n say the user type in 10) and every time the user presses the next button the code add 10 to this value. so the first time the user presses the next button
n= n + 10;
what i have found is no matter how many times i press the next button n will always equal 20, because the previous value is not saved !!
these values are populated the first time the user enters that page, once the user clicks the next button the content of these values disappear! how can stop this from happening ??
hope this makes sense !!
thanks