在web.config上注册一个控件程序集

时间:2012-10-22 14:06:56

标签: c# asp.net web-config ckeditor .net-assembly

我在我的项目中使用CKEditor,但是我试图让它工作而不需要在我正在使用它的每个页面中声明程序集。

我宣布的集会就是这个:

<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>

按照this website上的说明,我在web.config中进行了以下更改

  <system.web>
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
      <controls>
        <add tagPrefix="CKEditor" assembly="CKEditor.NET"/>
      </controls>
    </pages>
  </system.web>

但我一直收到这个错误

  

分析程序错误消息: tagPrefix条目中找到的属性无效或缺失。对于用户控件,还必须指定'tagName'和   'SRC'。对于自定义控件,还必须指定“命名空间”和   可选'组装'

我不确定我做错了什么。也许是一件愚蠢的事,不确定。

3 个答案:

答案 0 :(得分:5)

您需要指定命名空间。

  

...对于自定义控件,您还必须指定'namespace',和   可选地'组装'。

  <system.web>
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
      <controls>
        <add tagPrefix="CKEditor" assembly="CKEditor.NET" namespace="CKEditor"/>
      </controls>
    </pages>
  </system.web>

当然,假设命名空间是CKEditor。

答案 1 :(得分:1)

实施例

  <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

请注意,与缺少命名空间以及版本(如果适用)相比,错误状态需要指定命名空间和程序集。

答案 2 :(得分:1)

您无需在Web.Config中注册它。遵循官方网站的指示:

CKEditor Documentation

以下是CKEditor设置中的视频:

How to install CK Editor (FCK Editor) on your website

安装此方法最简单的方法是使用Nuget

相关问题