Hi,
Can I use variables declared in a code behind file in a .aspx file?
If so, what needs to be done to make these variables available?
If I am using a .ascx file instead of an .aspx, does this have any impact?
Responses are appreciated.
Cheers,
Adam
Marina - 20 Jul 2005 14:46 GMT
Yes. They need to be declared protected or public.
> Hi,
>
[quoted text clipped - 9 lines]
>
> Adam
Brock Allen - 20 Jul 2005 14:47 GMT
Since codebehind is simply a base class to the ASPX or ASCX, as long as members
are marked protected they are visible to the derived class.
-Brock
DevelopMentor
http://staff.develop.com/ballen
> Hi,
>
[quoted text clipped - 10 lines]
>
> Adam
Karl Seguin - 20 Jul 2005 15:24 GMT
As Marina and Brock have answered, yes you can...it's merely an
accessibility issue. The point of my reply is to ask why you want to?
There are certainly cases where you have to, but as a general rule I'd say
it's good to avoid this if possible.
Karl

Signature
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
> Hi,
>
[quoted text clipped - 9 lines]
>
> Adam