neewbie : include virtual

Discussion in 'ASP .Net' started by Mark, Oct 18, 2003.

  1. Mark

    Mark Guest

    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
     
    Mark, Oct 18, 2003
    #1
    1. Advertising

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

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://Steve.Orr.net


    "Mark" <> wrote in message
    news:...
    > 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
    >
    >
     
    Steve C. Orr [MVP, MCSD], Oct 18, 2003
    #2
    1. Advertising

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

    ---
    Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/
     
    Wim Hollebrandse, Oct 18, 2003
    #3
  4. Mark

    Mark Guest

    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" <> wrote in message
    news:...
    > 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
    >
    > ---
    > Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/
     
    Mark, Oct 19, 2003
    #4
  5. These articles should give you a good start:
    http://msdn.microsoft.com/library/d...n/html/vbconintroductiontowebusercontrols.asp
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vboriwebusercontrols.asp
    http://msdn.microsoft.com/library/d...l/vbconWebUserControlsVsCustomWebControls.asp

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://Steve.Orr.net
    Hire top-notch developers at http://www.able-consulting.com




    "Mark" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:...
    > > 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
    > >
    > > ---
    > > Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/

    >
    >
     
    Steve C. Orr [MVP, MCSD], Oct 19, 2003
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Danny Anderson
    Replies:
    5
    Views:
    511
    Victor Bazarov
    Aug 15, 2003
  2. Rolf Magnus
    Replies:
    2
    Views:
    608
    Karl Heinz Buchegger
    Nov 28, 2003
  3. Elie Nader
    Replies:
    1
    Views:
    646
  4. Andreas Bogenberger
    Replies:
    3
    Views:
    947
    Andreas Bogenberger
    Feb 22, 2008
  5. rockdale

    include virtual in virtual directory?

    rockdale, Sep 3, 2008, in forum: ASP General
    Replies:
    3
    Views:
    447
    rockdale
    Sep 4, 2008
Loading...

Share This Page