neewbie : include virtual

M

Mark

Hi,
Here's what's up:
I have a subroutine getAds () that I possibly will need to call more than
once in a page (and on more than one page). When I have the sub code on the
same page, it works fine.
When I try and move it to a separate page (to consolidate all of the
commonly called ones) and use <!-- include virtual =
"somefolder/somepage.aspx"-->
I get no errors about not being able to find the file, so I'm assuming it's
being included, but when I call getAds() , I get an error saying 'getAds()'
is not declared.


I'm putting the include tag directly after my page directive and my sub
accepts one parameter.
How can I move my commonly called subs to another page and reference them?

Sorry If I'm overlooking something incredibly obvious.

Thanks,
Mark
 
S

Steve C. Orr [MVP, MCSD]

Include files are old fashioned.
In ASP.NET you have better options, such as web user controls (for shared
visual elements), or putting all your shared code into one or more common
classes.
You'll be a better developer if you point yourself toward these more object
oriented solutions.
 
W

Wim Hollebrandse

Totally agree with Steve there.

User controls offer so much more than include files. You can expose properties for your user control and access these from codebehind pages.

Also - user controls can be cached; something called 'partial caching'.

Hope that helps.

Regards,
Wim Hollebrandse
http://www.wimdows.net
http://www.wimdows.com
 
M

Mark

I'm using WebMatrix for the time being, and I (maybe incorrectly) am under
the impression that it does not support code behind.
I'll take your advice, (although I've been able to get the include files
working) and read up on your ideas. Anyone know of a good tutorial?
Wim Hollebrandse said:
Totally agree with Steve there.

User controls offer so much more than include files. You can expose
properties for your user control and access these from codebehind pages.
 

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
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top