我的控件“这里不允许,因为它没有扩展类'System.Web.UI.UserControl'"

My control is quot;not allowed here because it does not extend class #39;System.Web.UI.UserControl#39;quot;(我的控件“这里不允许,因为它没有扩展类System.Web.UI.UserControl)
本文介绍了我的控件“这里不允许,因为它没有扩展类'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'"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)