neewbie : include virtual

  • Thread starter Thread starter Mark
  • Start date Start date
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
 
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.
 
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
 
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.
 
Back
Top