问题描述
所以我有另一个面条刮刀(反正对我来说).
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'"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!