My control is quot;not allowed here because it does not extend class #39;System.Web.UI.UserControl#39;quot;(我的控件“这里不允许,因为它没有扩展类System.Web.UI.UserControl)
问题描述
所以我有另一个面条刮刀(反正对我来说).
So I have another noodle-scratcher (for me anyway).
我正在尝试在我只有部分源代码的 CMS 中创建自己的自定义控件(即供应商提供给我的示例).基本上,我创建了一个名为 DataDefinitionContent
的类,它扩展了 ControlBase
.现在,从我可以从元数据中获得的信息来看,ControlBase
扩展了 UserControl
,所以我原以为这不会发生戏剧性的事情.谁能解释为什么这对我不起作用?
I'm trying to create my own custom control in a CMS I only have partial source code for (i.e. samples the vendor has supplied to me). Basically I have created a class called DataDefinitionContent
which extends ControlBase
. Now, from what I can garner from the metadata, ControlBase
extends UserControl
, so I would have thought this would run without a drama. Can anyone shed any light on why this might not be working for me?
我的班级:
public partial class DataDefinitionContent : ControlBase, ICustomControl<DataDefinition>
{
... Stuff
}
控制基础:
using System;
using System.Web.UI;
namespace CMS.Web
{
public class ControlBase : UserControl
{
... Stuff
}
}
我的 ascx 文件:
My ascx file:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DataDefinitionContent.ascx.cs"
Inherits="CMS.Admin.WebUI.CustomControls.DataDefinitionContent, CoA.Admin.WebUI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" %>
我得到的错误:
解析器错误消息:'CMS.Admin.WebUI.CustomControls.DataDefinitionContent,CoA.Admin.WebUI,版本=1.0.0.0,文化=中立,PublicKeyToken=null'这里不允许,因为它确实不扩展类'System.Web.UI.UserControl'.
Parser Error Message: 'CMS.Admin.WebUI.CustomControls.DataDefinitionContent, CoA.Admin.WebUI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not allowed here because it does not extend class 'System.Web.UI.UserControl'.
第 1 行:<%@控制语言=C#"AutoEventWireup=真";CodeBehind=DataDefinitionContent.ascx.cs"
Line 1: <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DataDefinitionContent.ascx.cs"
推荐答案
尝试将你的部分类放入
namespace CMS.Web
这篇关于我的控件“这里不允许,因为它没有扩展类'System.Web.UI.UserControl'"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:我的控件“这里不允许,因为它没有扩展类'System.Web.UI.UserControl'"


- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- 输入按键事件处理程序 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01