ASP.NET and includes

Discussion in 'ASP .Net' started by =?Utf-8?B?RGFjdW5h?=, Oct 19, 2004.

  1. I'm a begginer at ASP.NET having developed for several years in ASP and
    VBScript.

    I am developing a website where I'm componetazing the header, content
    section and the footer. Each secion is a different page.

    My codes looks like something like this

    <%@ Page Language="vb" AutoEventWireup="false" Codebehind="default.aspx.vb"
    Inherits="LDOL._default" %>
    <html>
    <!--#include file="header.aspx"-->
    default page content here...
    <!--#include file="footer.aspx"-->
    </html>

    My dilema comes when I have different functions in the header.vb page (such
    as getting metatags from a db) that cannot be seen because the default.aspx
    page looks for the function in the default.vb page instead. It returns an
    error "Function not declared". I've tried to find a way where I can have all
    my common functions in a centrailzed place (like the global.asax) but have
    not been successfull. Am I trying to make ASP.NET do something that was a
    shortcoming of ASP? That is what is seems to me...
    --
    Thank you for your help
    --
    Thank you for your help
     
    =?Utf-8?B?RGFjdW5h?=, Oct 19, 2004
    #1
    1. Advertising

  2. =?Utf-8?B?RGFjdW5h?=

    CJ Taylor Guest

    Yeah... once was enough... and no.. it doesn't support includes like ASP

    "Dacuna" <> wrote in message
    news:...
    > I'm a begginer at ASP.NET having developed for several years in ASP and
    > VBScript.
    >
    > I am developing a website where I'm componetazing the header, content
    > section and the footer. Each secion is a different page.
    >
    > My codes looks like something like this
    >
    > <%@ Page Language="vb" AutoEventWireup="false"

    Codebehind="default.aspx.vb"
    > Inherits="LDOL._default" %>
    > <html>
    > <!--#include file="header.aspx"-->
    > default page content here...
    > <!--#include file="footer.aspx"-->
    > </html>
    >
    > My dilema comes when I have different functions in the header.vb page

    (such
    > as getting metatags from a db) that cannot be seen because the

    default.aspx
    > page looks for the function in the default.vb page instead. It returns an
    > error "Function not declared". I've tried to find a way where I can have

    all
    > my common functions in a centrailzed place (like the global.asax) but have
    > not been successfull. Am I trying to make ASP.NET do something that was a
    > shortcoming of ASP? That is what is seems to me...
    > --
    > Thank you for your help
    > --
    > Thank you for your help
     
    CJ Taylor, Oct 19, 2004
    #2
    1. Advertising

  3. Yes CJ Taylor is right but you can use this if you use inline asp rather than
    code behind. There is also another .NET way of doing this. You can create a
    web user control for both header and footer, put all you code and gui in
    there and just insert the user control on your default.aspx page. This way
    you can access the functions/methods in your header(user control) by <user
    control name>.<function/method name ()>. This is the way that you are
    intended to do this in asp.net



    "Dacuna" wrote:

    > I'm a begginer at ASP.NET having developed for several years in ASP and
    > VBScript.
    >
    > I am developing a website where I'm componetazing the header, content
    > section and the footer. Each secion is a different page.
    >
    > My codes looks like something like this
    >
    > <%@ Page Language="vb" AutoEventWireup="false" Codebehind="default.aspx.vb"
    > Inherits="LDOL._default" %>
    > <html>
    > <!--#include file="header.aspx"-->
    > default page content here...
    > <!--#include file="footer.aspx"-->
    > </html>
    >
    > My dilema comes when I have different functions in the header.vb page (such
    > as getting metatags from a db) that cannot be seen because the default.aspx
    > page looks for the function in the default.vb page instead. It returns an
    > error "Function not declared". I've tried to find a way where I can have all
    > my common functions in a centrailzed place (like the global.asax) but have
    > not been successfull. Am I trying to make ASP.NET do something that was a
    > shortcoming of ASP? That is what is seems to me...
    > --
    > Thank you for your help
    > --
    > Thank you for your help
     
    =?Utf-8?B?QWJoaXNoZWsgUGF0ZWw=?=, Oct 19, 2004
    #3
    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. Geraldine

    includes in ASP .NET

    Geraldine, Oct 28, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    332
    Kevin Spencer
    Oct 29, 2003
  2. Steve

    Virtual Includes in ASP.NET

    Steve, Nov 19, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    426
    Jim Cheshire [MSFT]
    Nov 19, 2003
  3. Davíð Þórisson

    migrating asp to aspl.net: includes?

    Davíð Þórisson, Dec 30, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    403
    Davíð Þórisson
    Dec 30, 2003
  4. Jay

    Using includes with ASP.NET

    Jay, Jan 13, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    503
  5. =?Utf-8?B?RGFjdW5h?=

    ASP.NET and includes

    =?Utf-8?B?RGFjdW5h?=, Oct 19, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    313
    =?Utf-8?B?RGFjdW5h?=
    Oct 19, 2004
Loading...

Share This Page