<%@ Page language="c#" Codebehind="index.aspx.cs" AutoEventWireup="false" Inherits="my.Index" %>
<!--#include file="Header.aspx"-->
Header.aspx 代码:
<%@ Page language="c#" Codebehind="Header.aspx.cs" AutoEventWireup="false" Inherits="my.Inc.Header" %>
.....
运行index.aspx后 错误提示
分析器错误信息: 只能有一个“page”指令。
这问题怎么解决
难道要把Header.aspx 代码:
<%@ Page language="c#" Codebehind="Header.aspx.cs" AutoEventWireup="false" Inherits="my.Inc.Header" %> 这部分去掉
13 个解决方案
#1
和ASP一个样啊
#2
和ASP一样嵌入 不过嵌入页面不要用CODE-BEHIND
建议改成 用户控件
建议改成 用户控件
#3
将这个被包含文件转换为一个 .ascx 文件,之后将其放入你的 aspx 页面。编写这些控件与编写工程所使用的语言必须相同。如果你决定采用C#,并且你有一些采用VisualBasic 编写的包含页面,那么你需要将他们转换为C#。现在,你可以使用如下方法将它包含在aspx页面中了。在aspx页面的顶部声明它。
<%@ Register TagPrefix="thisSite" TagName="copyright"
src="includes/cr.ascx" %>
之后,当你想在页面中放置它时,使用如下元素来调用它:
<thisSite:copyright id="copyright1" runat="server">
</thisSite:copyright>
<%@ Register TagPrefix="thisSite" TagName="copyright"
src="includes/cr.ascx" %>
之后,当你想在页面中放置它时,使用如下元素来调用它:
<thisSite:copyright id="copyright1" runat="server">
</thisSite:copyright>
#4
改成用户控件吧,方便呀~!
#5
luoxia001(沉默,完完全全把你放在心中)
讲的是正确的
讲的是正确的
#6
m
#7
<%@ Register TagPrefix="thisSite" TagName="copyright"
src="includes/cr.ascx" %>
使用如下元素来调用它:
<thisSite:copyright id="copyright1" runat="server">
</thisSite:copyright>
执行后 有调试错误 25行缺少;
<form name="copyright1:FrmHeard" method="post" action="index.aspx" id="copyright1_FrmHeard">
<input type="hidden" name="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" value="dDw2ODY1NDE0NjY7Oz42dNP8/VGzqfVUIIFU0n0vjK4zaw==" />
<script language="javascript">
<!--
function __doPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
theform = document.forms["copyright1:FrmHeard"];
}
else {
theform = document.copyright1:FrmHeard;
}
theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}
// -->
</script>
src="includes/cr.ascx" %>
使用如下元素来调用它:
<thisSite:copyright id="copyright1" runat="server">
</thisSite:copyright>
执行后 有调试错误 25行缺少;
<form name="copyright1:FrmHeard" method="post" action="index.aspx" id="copyright1_FrmHeard">
<input type="hidden" name="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" value="dDw2ODY1NDE0NjY7Oz42dNP8/VGzqfVUIIFU0n0vjK4zaw==" />
<script language="javascript">
<!--
function __doPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
theform = document.forms["copyright1:FrmHeard"];
}
else {
theform = document.copyright1:FrmHeard;
}
theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}
// -->
</script>
#8
includes/cr.ascx 代码部分:
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="cr.ascx.cs" Inherits="cr.ascx"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<form id="FrmHeard" method="post" runat="server">
<table cellSpacing="0" cellPadding="0" width="1004" align="center" background="/XOCO.net/Images/top_bgline_h.jpg"
border="0">
<tr>
<td width="790">
.....
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="cr.ascx.cs" Inherits="cr.ascx"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<form id="FrmHeard" method="post" runat="server">
<table cellSpacing="0" cellPadding="0" width="1004" align="center" background="/XOCO.net/Images/top_bgline_h.jpg"
border="0">
<tr>
<td width="790">
.....
#9
嗯,用户控件比较好.
#10
includes/cr.ascx 代码部分:
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="cr.ascx.cs" Inherits="cr.ascx"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<form id="FrmHeard" method="post" runat="server">
<table cellSpacing="0" cellPadding="0" width="1004" align="center" background="/Images/top_bgline_h.jpg" border="0">
<tr>
<TD align='right' width="180">
<asp:calendar id="calDay" runat="server" Width="98%" DayNameFormat="FirstLetter" TodayDayStyle-ForeColor="#5e715e"
TodayDayStyle-Font-Bold="true" TodayDayStyle-BorderWidth="1" TodayDayStyle-BorderColor="#5e715e" DayHeaderStyle-ForeColor="#ffffff"
WeekendDayStyle-BackColor="#eeeeee" CellSpacing="1" NextPrevStyle-ForeColor="#ffffff" TitleStyle-ForeColor="#ffffff"
OtherMonthDayStyle-ForeColor="#cccccc" DayHeaderStyle-BackColor="#5e715e" height="95%">
<TodayDayStyle Font-Bold="True" BorderWidth="1px" ForeColor="#5E715E" BorderColor="#5E715E"></TodayDayStyle>
<NextPrevStyle ForeColor="White"></NextPrevStyle>
<DayHeaderStyle ForeColor="White" BackColor="#5E715E"></DayHeaderStyle>
<TitleStyle ForeColor="White"></TitleStyle>
<WeekendDayStyle BackColor="#EEEEEE"></WeekendDayStyle>
<OtherMonthDayStyle ForeColor="#CCCCCC"></OtherMonthDayStyle>
</asp:calendar></TD>
</tr>
</table>
</form>
用了 日历控件
<%@ Register TagPrefix="thisSite" TagName="copyright"
src="includes/cr.ascx" %>
使用如下元素来调用它:
<thisSite:copyright id="copyright1" runat="server">
</thisSite:copyright>
执行后 有调试错误 25行缺少;
function __doPostBack(eventTarget, eventArgument) {
....
有问题 引用 自动生成的
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="cr.ascx.cs" Inherits="cr.ascx"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<form id="FrmHeard" method="post" runat="server">
<table cellSpacing="0" cellPadding="0" width="1004" align="center" background="/Images/top_bgline_h.jpg" border="0">
<tr>
<TD align='right' width="180">
<asp:calendar id="calDay" runat="server" Width="98%" DayNameFormat="FirstLetter" TodayDayStyle-ForeColor="#5e715e"
TodayDayStyle-Font-Bold="true" TodayDayStyle-BorderWidth="1" TodayDayStyle-BorderColor="#5e715e" DayHeaderStyle-ForeColor="#ffffff"
WeekendDayStyle-BackColor="#eeeeee" CellSpacing="1" NextPrevStyle-ForeColor="#ffffff" TitleStyle-ForeColor="#ffffff"
OtherMonthDayStyle-ForeColor="#cccccc" DayHeaderStyle-BackColor="#5e715e" height="95%">
<TodayDayStyle Font-Bold="True" BorderWidth="1px" ForeColor="#5E715E" BorderColor="#5E715E"></TodayDayStyle>
<NextPrevStyle ForeColor="White"></NextPrevStyle>
<DayHeaderStyle ForeColor="White" BackColor="#5E715E"></DayHeaderStyle>
<TitleStyle ForeColor="White"></TitleStyle>
<WeekendDayStyle BackColor="#EEEEEE"></WeekendDayStyle>
<OtherMonthDayStyle ForeColor="#CCCCCC"></OtherMonthDayStyle>
</asp:calendar></TD>
</tr>
</table>
</form>
用了 日历控件
<%@ Register TagPrefix="thisSite" TagName="copyright"
src="includes/cr.ascx" %>
使用如下元素来调用它:
<thisSite:copyright id="copyright1" runat="server">
</thisSite:copyright>
执行后 有调试错误 25行缺少;
function __doPostBack(eventTarget, eventArgument) {
....
有问题 引用 自动生成的
#11
Header.aspx改为用户控件
#12
用placeholder包含啊
#13
Header.aspx文件中,调试正确后,去掉page指令.
我经常这样包含文件的.
如果Header.aspx可以用保存为.asp或.inc的话,最好还是用这些.
我经常这样包含文件的.
如果Header.aspx可以用保存为.asp或.inc的话,最好还是用这些.
#1
和ASP一个样啊
#2
和ASP一样嵌入 不过嵌入页面不要用CODE-BEHIND
建议改成 用户控件
建议改成 用户控件
#3
将这个被包含文件转换为一个 .ascx 文件,之后将其放入你的 aspx 页面。编写这些控件与编写工程所使用的语言必须相同。如果你决定采用C#,并且你有一些采用VisualBasic 编写的包含页面,那么你需要将他们转换为C#。现在,你可以使用如下方法将它包含在aspx页面中了。在aspx页面的顶部声明它。
<%@ Register TagPrefix="thisSite" TagName="copyright"
src="includes/cr.ascx" %>
之后,当你想在页面中放置它时,使用如下元素来调用它:
<thisSite:copyright id="copyright1" runat="server">
</thisSite:copyright>
<%@ Register TagPrefix="thisSite" TagName="copyright"
src="includes/cr.ascx" %>
之后,当你想在页面中放置它时,使用如下元素来调用它:
<thisSite:copyright id="copyright1" runat="server">
</thisSite:copyright>
#4
改成用户控件吧,方便呀~!
#5
luoxia001(沉默,完完全全把你放在心中)
讲的是正确的
讲的是正确的
#6
m
#7
<%@ Register TagPrefix="thisSite" TagName="copyright"
src="includes/cr.ascx" %>
使用如下元素来调用它:
<thisSite:copyright id="copyright1" runat="server">
</thisSite:copyright>
执行后 有调试错误 25行缺少;
<form name="copyright1:FrmHeard" method="post" action="index.aspx" id="copyright1_FrmHeard">
<input type="hidden" name="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" value="dDw2ODY1NDE0NjY7Oz42dNP8/VGzqfVUIIFU0n0vjK4zaw==" />
<script language="javascript">
<!--
function __doPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
theform = document.forms["copyright1:FrmHeard"];
}
else {
theform = document.copyright1:FrmHeard;
}
theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}
// -->
</script>
src="includes/cr.ascx" %>
使用如下元素来调用它:
<thisSite:copyright id="copyright1" runat="server">
</thisSite:copyright>
执行后 有调试错误 25行缺少;
<form name="copyright1:FrmHeard" method="post" action="index.aspx" id="copyright1_FrmHeard">
<input type="hidden" name="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" value="dDw2ODY1NDE0NjY7Oz42dNP8/VGzqfVUIIFU0n0vjK4zaw==" />
<script language="javascript">
<!--
function __doPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
theform = document.forms["copyright1:FrmHeard"];
}
else {
theform = document.copyright1:FrmHeard;
}
theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}
// -->
</script>
#8
includes/cr.ascx 代码部分:
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="cr.ascx.cs" Inherits="cr.ascx"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<form id="FrmHeard" method="post" runat="server">
<table cellSpacing="0" cellPadding="0" width="1004" align="center" background="/XOCO.net/Images/top_bgline_h.jpg"
border="0">
<tr>
<td width="790">
.....
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="cr.ascx.cs" Inherits="cr.ascx"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<form id="FrmHeard" method="post" runat="server">
<table cellSpacing="0" cellPadding="0" width="1004" align="center" background="/XOCO.net/Images/top_bgline_h.jpg"
border="0">
<tr>
<td width="790">
.....
#9
嗯,用户控件比较好.
#10
includes/cr.ascx 代码部分:
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="cr.ascx.cs" Inherits="cr.ascx"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<form id="FrmHeard" method="post" runat="server">
<table cellSpacing="0" cellPadding="0" width="1004" align="center" background="/Images/top_bgline_h.jpg" border="0">
<tr>
<TD align='right' width="180">
<asp:calendar id="calDay" runat="server" Width="98%" DayNameFormat="FirstLetter" TodayDayStyle-ForeColor="#5e715e"
TodayDayStyle-Font-Bold="true" TodayDayStyle-BorderWidth="1" TodayDayStyle-BorderColor="#5e715e" DayHeaderStyle-ForeColor="#ffffff"
WeekendDayStyle-BackColor="#eeeeee" CellSpacing="1" NextPrevStyle-ForeColor="#ffffff" TitleStyle-ForeColor="#ffffff"
OtherMonthDayStyle-ForeColor="#cccccc" DayHeaderStyle-BackColor="#5e715e" height="95%">
<TodayDayStyle Font-Bold="True" BorderWidth="1px" ForeColor="#5E715E" BorderColor="#5E715E"></TodayDayStyle>
<NextPrevStyle ForeColor="White"></NextPrevStyle>
<DayHeaderStyle ForeColor="White" BackColor="#5E715E"></DayHeaderStyle>
<TitleStyle ForeColor="White"></TitleStyle>
<WeekendDayStyle BackColor="#EEEEEE"></WeekendDayStyle>
<OtherMonthDayStyle ForeColor="#CCCCCC"></OtherMonthDayStyle>
</asp:calendar></TD>
</tr>
</table>
</form>
用了 日历控件
<%@ Register TagPrefix="thisSite" TagName="copyright"
src="includes/cr.ascx" %>
使用如下元素来调用它:
<thisSite:copyright id="copyright1" runat="server">
</thisSite:copyright>
执行后 有调试错误 25行缺少;
function __doPostBack(eventTarget, eventArgument) {
....
有问题 引用 自动生成的
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="cr.ascx.cs" Inherits="cr.ascx"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<form id="FrmHeard" method="post" runat="server">
<table cellSpacing="0" cellPadding="0" width="1004" align="center" background="/Images/top_bgline_h.jpg" border="0">
<tr>
<TD align='right' width="180">
<asp:calendar id="calDay" runat="server" Width="98%" DayNameFormat="FirstLetter" TodayDayStyle-ForeColor="#5e715e"
TodayDayStyle-Font-Bold="true" TodayDayStyle-BorderWidth="1" TodayDayStyle-BorderColor="#5e715e" DayHeaderStyle-ForeColor="#ffffff"
WeekendDayStyle-BackColor="#eeeeee" CellSpacing="1" NextPrevStyle-ForeColor="#ffffff" TitleStyle-ForeColor="#ffffff"
OtherMonthDayStyle-ForeColor="#cccccc" DayHeaderStyle-BackColor="#5e715e" height="95%">
<TodayDayStyle Font-Bold="True" BorderWidth="1px" ForeColor="#5E715E" BorderColor="#5E715E"></TodayDayStyle>
<NextPrevStyle ForeColor="White"></NextPrevStyle>
<DayHeaderStyle ForeColor="White" BackColor="#5E715E"></DayHeaderStyle>
<TitleStyle ForeColor="White"></TitleStyle>
<WeekendDayStyle BackColor="#EEEEEE"></WeekendDayStyle>
<OtherMonthDayStyle ForeColor="#CCCCCC"></OtherMonthDayStyle>
</asp:calendar></TD>
</tr>
</table>
</form>
用了 日历控件
<%@ Register TagPrefix="thisSite" TagName="copyright"
src="includes/cr.ascx" %>
使用如下元素来调用它:
<thisSite:copyright id="copyright1" runat="server">
</thisSite:copyright>
执行后 有调试错误 25行缺少;
function __doPostBack(eventTarget, eventArgument) {
....
有问题 引用 自动生成的
#11
Header.aspx改为用户控件
#12
用placeholder包含啊
#13
Header.aspx文件中,调试正确后,去掉page指令.
我经常这样包含文件的.
如果Header.aspx可以用保存为.asp或.inc的话,最好还是用这些.
我经常这样包含文件的.
如果Header.aspx可以用保存为.asp或.inc的话,最好还是用这些.