Include files

Discussion in 'ASP .Net' started by Kraai, Oct 28, 2003.

  1. Kraai

    Kraai Guest

    in normal asp , and even php i could use the
    <!--#include file="login.aspx" -->
    or
    <!--#include virtual="login.aspx" -->

    to include pages in my main page without using frames!

    when i try this with my aspx page's i get the following
    error!
    There can be only one 'page' directive

    How do I fix this without changing the other pages
    functionallity/ design and code behind!

    I need the following for example:

    <table border="1" cellpadding="0" cellspacing="0"
    style="border-collapse: collapse" bordercolor="#111111"
    width="621" height="92" id="AutoNumber1">
    <tr>
    <td width="621" height="25" colspan="3"><!--#include
    virtual="header.aspx" --></td>
    </tr>
    <tr>
    <td width="63" height="42"><!--#include
    virtual="menu.aspx" --></td>
    <td width="511" height="42"><!--#include
    virtual="datapage.aspx" --></td>
    <td width="40" height="42"><!--#include
    virtual="left.aspx" --></td>
    </tr>
    <tr>
    <td width="621" height="19" colspan="3"><!--#include
    virtual="footer.aspx" --></td>
    </tr>
    </table>

    Any Ideas ?
     
    Kraai, Oct 28, 2003
    #1
    1. Advertising

  2. Kraai

    Jody Fisher Guest

    In ASP.Net we use user controls

    I have run out of time to show you an eg but will post again tomorrow if you
    still don't have an answer

    Cheers

    Jody

    "Kraai" <> wrote in message
    news:09b401c39d1f$a7afa900$...
    > in normal asp , and even php i could use the
    > <!--#include file="login.aspx" -->
    > or
    > <!--#include virtual="login.aspx" -->
    >
    > to include pages in my main page without using frames!
    >
    > when i try this with my aspx page's i get the following
    > error!
    > There can be only one 'page' directive
    >
    > How do I fix this without changing the other pages
    > functionallity/ design and code behind!
    >
    > I need the following for example:
    >
    > <table border="1" cellpadding="0" cellspacing="0"
    > style="border-collapse: collapse" bordercolor="#111111"
    > width="621" height="92" id="AutoNumber1">
    > <tr>
    > <td width="621" height="25" colspan="3"><!--#include
    > virtual="header.aspx" --></td>
    > </tr>
    > <tr>
    > <td width="63" height="42"><!--#include
    > virtual="menu.aspx" --></td>
    > <td width="511" height="42"><!--#include
    > virtual="datapage.aspx" --></td>
    > <td width="40" height="42"><!--#include
    > virtual="left.aspx" --></td>
    > </tr>
    > <tr>
    > <td width="621" height="19" colspan="3"><!--#include
    > virtual="footer.aspx" --></td>
    > </tr>
    > </table>
    >
    > Any Ideas ?
     
    Jody Fisher, Oct 28, 2003
    #2
    1. Advertising

  3. Kraai

    Guest Guest

    Hi,

    includes still work in ASP but, as the error message
    says, there can only page directive.

    The "page directive" is the "@Page" line at the top of
    the page (with a yellow background in VS.Net)

    One "conceptual way" of seeing it (although not very
    technical) is that by adding an include, all included
    pages form on "stream" (of HTML?) and that "stream" can
    only have on @Page statement.

    If you want to use UserControls, as previously suggested,
    check out this article - to get you started ! :

    http://msdn.microsoft.com/msdnmag/issues/01/08/cutting/def
    ault.aspx

    Here's one of my example :

    Main page :

    <%@ Page Language="vb" AutoEventWireup="false"
    Codebehind="HardwareOrder.aspx.vb"
    Inherits="HI_HO.HardwareOrder" SmartNavigation="True" %>

    <%@ Register TagPrefix="uc" TagName="Header"
    Src="UserControls/Header.ascx" %>

    (...)
    <html>
    <body>
    <FORM id="frmHardwareOrder" method="post" runat="server">
    <uc:Header id="ucHeader" runat="server"></uc:Header>

    (...)

    User control :

    <%@ Control Language="vb" AutoEventWireup="false"
    Codebehind="Header.ascx.vb" Inherits="HI_HO.Header"
    TargetSchema="http://schemas.microsoft.com/intellisense/ie
    5" %>

    NO FORM TAG (<FORM>)

    (...)

    Hope this helps !

    Ben

    >-----Original Message-----
    >in normal asp , and even php i could use the
    ><!--#include file="login.aspx" -->
    >or
    ><!--#include virtual="login.aspx" -->
    >
    >to include pages in my main page without using frames!
    >
    >when i try this with my aspx page's i get the following
    >error!
    >There can be only one 'page' directive
    >
    >How do I fix this without changing the other pages
    >functionallity/ design and code behind!
    >
    >I need the following for example:
    >
    ><table border="1" cellpadding="0" cellspacing="0"
    >style="border-collapse: collapse" bordercolor="#111111"
    >width="621" height="92" id="AutoNumber1">
    > <tr>
    > <td width="621" height="25" colspan="3"><!--

    #include
    >virtual="header.aspx" --></td>
    > </tr>
    > <tr>
    > <td width="63" height="42"><!--#include
    >virtual="menu.aspx" --></td>
    > <td width="511" height="42"><!--#include
    >virtual="datapage.aspx" --></td>
    > <td width="40" height="42"><!--#include
    >virtual="left.aspx" --></td>
    > </tr>
    > <tr>
    > <td width="621" height="19" colspan="3"><!--

    #include
    >virtual="footer.aspx" --></td>
    > </tr>
    > </table>
    >
    >Any Ideas ?
    >.
    >
     
    Guest, Oct 28, 2003
    #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. Danny Anderson
    Replies:
    5
    Views:
    507
    Victor Bazarov
    Aug 15, 2003
  2. Rolf Magnus
    Replies:
    2
    Views:
    605
    Karl Heinz Buchegger
    Nov 28, 2003
  3. Elie Nader
    Replies:
    1
    Views:
    641
  4. Aguilar, James
    Replies:
    2
    Views:
    691
    Aguilar, James
    Jul 16, 2004
  5. Andreas Bogenberger
    Replies:
    3
    Views:
    931
    Andreas Bogenberger
    Feb 22, 2008
Loading...

Share This Page