Code Behind & Variables!

A

Adam Knight

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
 
B

Brock Allen

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.
 
K

Karl Seguin

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

--
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!)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top