如何修复“母版” system.web.ui.updatepanel错误中没有出现? [英] How to fix "masterpage" not present in system.web.ui.updatepanel error?
问题描述
我创建了一个名为site1的母版页,并插入了一个带有文本框和日历的更新面板。当我编译它时,它会给出错误:
类型名称'site1'在类型'System.Web.UI.UpdatePanel'中不存在
这是以下错误:
第179行:}
第180行:
第181行:[TemplateContainer(typeof(Panel) .Site1))
第182行:[TemplateInstanceAttribute(System.Web.UI.TemplateInstance.Single)]
第183行:public virtual System.Web.UI.ITemplate Template_head< / pre>
错误在于181行
我尝试了什么:
我尝试添加system.web.extensions但无处可去..
I created a masterpage named "site1" and inserted an updatepanel with a textbox and calendar. when I compile it, it gives error:
The type name 'site1' does not exist in the type 'System.Web.UI.UpdatePanel'
this is the following error:
Line 179: }
Line 180:
Line 181: [TemplateContainer(typeof(Panel.Site1))]
Line 182: [TemplateInstanceAttribute(System.Web.UI.TemplateInstance.Single)]
Line 183: public virtual System.Web.UI.ITemplate Template_head </pre>
Error lies in line 181
What I have tried:
i've tried adding system.web.extensions but have got nowhere..
推荐答案
如何发布代码,我无法创建错误。
我将写下您创建母版页所需的所有元素。
您的母版页
1 - 血肌酐iptmanager 组件是obrigatory。
Hi,
How you didn't post the code and i could not create the error.
I will write all the elements necessary for you create a master page.
Your master page
1 - Scriptmanager component is obrigatory.
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
2 - Updatepanel需要 ContentTemplate 标记。
2 - Updatepanel need to ContentTemplate tag.
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
</ContentTemplate>
</asp:UpdatePanel>
3 - 验证html和代码隐藏中的命名空间是否相同。
3 - Verify if the namespace is equal in the html and code-behind.
//HTML
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="aplicacao.Site1" %>
//Code-behind
namespace aplicacao {}
子页面
1 - 在子页面html中添加标签母版页。
Child Page
1 - Add tag master page in child page html.
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Site1.Master" CodeBehind="frmMyTest7.aspx.cs" Inherits="aplicacao.frmMyTest7" %>
<%@ MasterType VirtualPath="~/Site1.Master" %>
2 - 子页面中的内容标记是可行的。
2 - Content tag in child page is obrigatory.
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
</asp:Content>
以下是完整的代码可以帮助您。
母版页
HTML
Below is the complete code to help you.
Master Page
HTML
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:TextBox runat="server"></asp:TextBox>
<asp:Calendar runat="server"></asp:Calendar>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
代码隐藏
Code-behind
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace aplicacao
{
public partial class Site1 : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
儿童页面
HTML
Child Page
HTML
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Site1.Master" CodeBehind="frmMyTest7.aspx.cs" Inherits="aplicacao.frmMyTest7" %>
<%@ MasterType VirtualPath="~/Site1.Master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
</asp:Content>
代码隐藏
Code-behind
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace aplicacao
{
public partial class frmMyTest7 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
这篇关于如何修复“母版” system.web.ui.updatepanel错误中没有出现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!