在asp.net中的ckeditor

时间:2010-10-11 13:00:27

标签: asp.net ckeditor

我必须在我的应用程序中使用ckeditor但我不知道如何编写

@ Register Assembly =“”Namespace =“”TagPrefix =“”%>

从哪里可以得到装配?

4 个答案:

答案 0 :(得分:2)

web.config部分,您可以写:

<add tagPrefix="FredCK" namespace="FredCK.CKEditor" assembly="FredCK.CKEditor, Culture=neutral, PublicKeyToken=9ef91de3e191403a" />

答案 1 :(得分:1)

实际上,最好不要使用ASP.NET CKEditor控件,而是直接使用CKEditor。控件已过时(版本3.6而不是4.1)并且没有必要。基本上,使用多行文本框并使其成为CKEditor类。不要忘记将ckEditor.js添加到head部分:

<强>的web.config

<configuration>
    <system.web>
        <httpRuntime requestValidationMode="2.0"/>
        <compilation debug="true" targetFramework="4.0" />
    </system.web>
</configuration>

<强> Test.aspx文件

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>ckeditor test page</title>
    <script src="ckeditor/ckeditor.js" type="text/javascript"></script>
</head>
<body>
  <form id="form1" runat="server">

    <p>
      <asp:TextBox  class="ckeditor" ID="CkeditorTextBox" runat="server" TextMode="MultiLine" Columns="80" Rows="10">
        Hi
      </asp:TextBox>
    </p>

    <p>
      <asp:Button ID="SubmitButton" runat="server" onclick="SubmitButton_Click" Text="Submit" />
    </p>
  </form>
</body>
</html>

<强> Test.aspx.cs

using System;

public partial class Test : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void SubmitButton_Click(object sender, EventArgs e) {
      string CkEditorText = CkeditorTextBox.Text;
      //add some processing here
    }
}

答案 2 :(得分:0)

ckeditor有一个很好的asp.net包装器控件:http://cksource.com/forums/viewtopic.php?f=11&t=15882

答案 3 :(得分:0)

答案是

scrpt type = "text/javascript" src = "ckeditor/ckeditor.js"....close script 
//ckeditor is the folder that you have created in your application.

script type="text/javascript"
window.onload = function()

{
    debugger
    vartxtDemo = document.getElementByID('<%txtDemo.ClientID%');
    CKEDITOR.replace(txtDemo);

}...//close the script

但在此之前在您的应用程序中创建一个ckeditor文件夹并粘贴您已下载的内容