Commonly, if we want to code on our designer page[aspx], we should be aware about the scope of a variables on the same.
Once, I wanted to show same information on more than one place, I used variable but after a long research i came to know that “VARIABLE SCOPE IS DEVIDED AS PER SECTION HAVING RUNAT=’SERVER’ ON THE DESIGNER PAGE.”.
Please make sure if you want to use common varibles, use them within same block having runat=’server’.
Feel free to clear your doubts –> me@anoopkumarsharma.com
I faced a problem that I was not able to access a variable in the head section of my aspx page. Can you help?
Yes Aarti. Please note that variable scope is maintained as per their blocking defined by runat=server . so if you want to access same variable on head please make sure that all related sections should be in same runat=server block.
Better to control your head section from your code behind or from body section of designer.
Ok thanx I will try this and then get back to you.
Thanks it worked