Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2005

Tip: Looking for answers? Try searching our database.

Code Behind & Variables!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Adam Knight - 20 Jul 2005 14:43 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.