我的控制"在这里不允许的,因为它不会扩展类'System.Web.UI.UserControl'" [英] My control is "not allowed here because it does not extend class 'System.Web.UI.UserControl'"

查看:626
本文介绍了我的控制"在这里不允许的,因为它不会扩展类'System.Web.UI.UserControl'"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我有另一种面条饼刷(我反正)。



我想创建一个CMS自己的自定义控制我只有部分源代码问题(即样本厂商都提供给我)。基本上,我创建了一个名为 DataDefinitionContent 延伸 ControlBase 类。现在,从我可以从元数据争取, ControlBase 扩展用户控件,所以我还以为这将不运行一台戏。任何人都可以摆脱任何光线为什么这可能不是为我工作?






我的类别:

 公共部分类DataDefinitionContent:ControlBase,ICustomControl< D​​ataDefinition> 
{
...的东西
}



ControlBase:

 使用系统; 
使用System.Web.UI程序;
命名空间CMS.Web
{
公共类ControlBase:用户控件
{
...的东西
}
}

我的ascx文件:

 <%@控制语言=C#AutoEventWireup =真正的代码隐藏=DataDefinitionContent.ascx.cs
继承=CMS.Admin.WebUI.CustomControls.DataDefinitionContent,CoA.Admin.WebUI,版本= 1.0.0.0,文化=中立,公钥=空%GT;



我得到的错误:



<块引用>

分析器错误信息:
'CMS.Admin.WebUI.CustomControls.DataDefinitionContent,
CoA.Admin.WebUI,版本= 1.0.0.0,
区域性=中性公钥=空,因为它确实
没有扩展类

在这里不允许使用'System.Web.UI.UserControl。



1号线:
<%@控制语言=C#
AutoEventWireup =真正的代码隐藏=DataDefinitionContent.ascx.cs



解决方案

尝试把你的部分类

 命名空间CMS.Web 


So I have another noodle-scratcher (for me anyway).

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?


My Class:

public partial class DataDefinitionContent : ControlBase, ICustomControl<DataDefinition>
{
... Stuff
}

ControlBase:

using System;
using System.Web.UI;
namespace CMS.Web
{
    public class ControlBase : UserControl
    {
    ... Stuff
    }
}

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" %>

The error I'm getting:

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'.

Line 1: <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DataDefinitionContent.ascx.cs"

解决方案

Try putting your partial class in

namespace CMS.Web

这篇关于我的控制&QUOT;在这里不允许的,因为它不会扩展类'System.Web.UI.UserControl'&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆