我做了一个ASP.NET WEB应用程序,项目名是 montest ,作了一个用户控件 head.ascx ,和一个页面 index.aspx .将head.ascx 嵌入 index.aspxhead.ascx 头代码:
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="head.ascx.cs" Inherits="montest.head" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
index.aspx 代码为:<%@ Page language="c#" Codebehind="index.aspx.cs" AutoEventWireup="false" %>
<%@ Register TagPrefix="sc" TagName="head" Src="head.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>index</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<sc:head id="head" runat="server"></sc:head>
</form>
</body>
</HTML>
本地运行没错,把整个项目上传到网上空间,运行就报错:分析器错误信息: 未能加载类型“montest.head”。源错误:
行 1: <%@ Control Language="c#" AutoEventWireup="false" Codebehind="head.ascx.cs" Inherits="montest.head" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%> 源文件: wwwroot\montest\head.ascx 行: 1 请各位高手指点,谢谢!
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="head.ascx.cs" Inherits="montest.head" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
index.aspx 代码为:<%@ Page language="c#" Codebehind="index.aspx.cs" AutoEventWireup="false" %>
<%@ Register TagPrefix="sc" TagName="head" Src="head.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>index</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<sc:head id="head" runat="server"></sc:head>
</form>
</body>
</HTML>
本地运行没错,把整个项目上传到网上空间,运行就报错:分析器错误信息: 未能加载类型“montest.head”。源错误:
行 1: <%@ Control Language="c#" AutoEventWireup="false" Codebehind="head.ascx.cs" Inherits="montest.head" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%> 源文件: wwwroot\montest\head.ascx 行: 1 请各位高手指点,谢谢!
解决方案 »
- SAP NCO3.0 懂得使用的来 在线等!!!!!!!!!!!!!!
- asp.net 如何确保在同一时刻仅有一个客户可修改和存取数据
- 页面如何提示???
- jquery 例外被抛出且未被接住
- 必须放在具有 runat=server 的窗体标记内?
- Enabled='<%# DataBinder.Eval(Container, "DataItem.answer")=="批准" %>' 为什么执行结果不对,全部unEnabled
- 【求助】急需基于ASP.NET的学生成绩管理系统!!!
- VS.NET令我烦恼!哪位老兄把这50分拿去。
- 请教各位高手,是否能用asp.net做一个像foxmail那样的客户端软件界面?
- 求一个正则表达式,用来实现二级域名,当二级是www或以n结尾的不重写,因为是保留二级
- 大家看看我的session怎么了?
- 初学者请教:ascx文件能不能调用page_load事件阿
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls; /// <summary>
/// head 的摘要说明。
/// </summary>
public class head : System.Web.UI.UserControl
{
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Label Label1; private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
} #region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器
/// 修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load); }
#endregion private void Button1_Click(object sender, System.EventArgs e)
{
this.Label1.Text = "The button is down! ";
}
}
}
<%@ Control Language="c#" AutoEventWireup="false" src="head.ascx.cs" Inherits="montest.head" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<asp:Button id="Button1" runat="server" />
<asp:Label id="Label1" runat="server" />if it works, it means head.ascx.cs is not part of the project or you can use ILDASM.exe to check if montest.head is in the assembly