Can I use static variable in a page?
-
I m building an application in which I redirect the user to a particular page. In the Page Load event of the that page , I assign a variable some value. Then I call the Button click event on that page. I have applied the !IsPostBack so that the Page Load event does not occur on clicking the button. Now the problem is that I want to use the value of that variable which i was population on Page Load event. Can I use that variable as static? I have a doubt in my mind that as I am simply redirecting the users to that page, the value of that variable could be set to some another value if another user is redirected to that page as the variable is static. Please help me to clarify my concept. Thanks, Sandy
-
I m building an application in which I redirect the user to a particular page. In the Page Load event of the that page , I assign a variable some value. Then I call the Button click event on that page. I have applied the !IsPostBack so that the Page Load event does not occur on clicking the button. Now the problem is that I want to use the value of that variable which i was population on Page Load event. Can I use that variable as static? I have a doubt in my mind that as I am simply redirecting the users to that page, the value of that variable could be set to some another value if another user is redirected to that page as the variable is static. Please help me to clarify my concept. Thanks, Sandy
-
hi, if u want to access that variable on post back u have to define that variable as static . bye
-
The problem is that all visitors share the same static variable... --- b { font-weight: normal; }
Can I store that variable in View state to remove this problem? because I don't want to share the variable between different users. Thanks, Sandy Sekhon
-
Can I store that variable in View state to remove this problem? because I don't want to share the variable between different users. Thanks, Sandy Sekhon