所以我还有另一个面条抓手(无论如何对我来说)。
我正在尝试在CMS中创建自己的自定义控件,我仅提供了部分源代码(即供应商提供给我的示例)。基本上,我创建了一个名为DataDefinitionContent的类,该类扩展了ControlBase。现在,从我可以从元数据中获得的信息来看,ControlBase扩展了UserControl,所以我本来以为这将没有戏剧性。谁能阐明为什么这可能对我不起作用?

我的课:

public partial class DataDefinitionContent : ControlBase, ICustomControl<DataDefinition>
{
... Stuff
}
ControlBase:
using System;
using System.Web.UI;
namespace CMS.Web
{
    public class ControlBase : UserControl
    {
    ... Stuff
    }
}
我的ascx文件:
<%@ 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" %>
我得到的错误:

最佳答案

尝试将您的部分类(class)放在

namespace CMS.Web

关于c# - 我的控件是 “not allowed here because it does not extend class ' System.Web.UI.UserControl'”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/1665521/

10-08 22:51