Include files

  • Thread starter Thread starter Kraai
  • Start date Start date
K

Kraai

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 ?
 
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
 
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
 
Back
Top