469,943 Members | 2,688 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,943 developers. It's quick & easy.

Include files

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 ?
Nov 17 '05 #1
2 2879
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" <jo***@hr-focus.com> wrote in message
news:09****************************@phx.gbl...
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 ?

Nov 17 '05 #2
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/is...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"><!-- #includevirtual="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"><!-- #includevirtual="footer.aspx" --></td>
</tr>
</table>

Any Ideas ?
.

Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by atv | last post: by
5 posts views Thread by David Mathog | last post: by
1 post views Thread by ya man | last post: by
9 posts views Thread by chat | last post: by
2 posts views Thread by key9 | last post: by
16 posts views Thread by Chris Shearer Cooper | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.