By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,183 Members | 1,190 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,183 IT Pros & Developers. It's quick & easy.

Include files

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.