Posts

Showing posts from January, 2011

Accessing variables on and from masterpages, pages and usercontrols in asp.net

I was working on a project and had to perform certain actions like

-Access variables and functions on another page from an event generated from the MasterPage .
-Accessing variables on another page from a userControl .
-Accessing variables on the MasterPage .

The challenge i had here was that i had never done all these before .I have read a couple of books, blog , read source code from open source applications but never seen a situation like that .Then i asked myself the question.
Why would one want to carry out any of the procedures i stated above ?
I had to guess that they are some reasons to do this is ----
-It means that the design of the program was wrong from the beginning .
-You are forced to use it to fulfill a certain condition .
-It is the last choice you got.
Anyway i solved the problems by carrying out the above three procedures and i think it might help someone out there .Here is how i did it

Access variables and functions on another page from an event generated from the …