ckeditor in asp.net

岁酱吖の 提交于 2019-12-24 09:52:13

问题


I have to use a ckeditor in my application but I dont know how to write the

@ Register Assembly="" Namespace="" TagPrefix="" %>

From where I could get the assembly?


回答1:


In web.config section you can write:

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



回答2:


Actually, best is not to use the ASP.NET CKEditor control but use CKEditor directly. The control is outdated (version 3.6 instead of 4.1) and not necessary. Basically, use a multiline textbox and make it of the class CKEditor. Don't forget to add the ckEditor.js to the head section:

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
    }
}



回答3:


There is a nice asp.net wrapper control for the ckeditor: http://cksource.com/forums/viewtopic.php?f=11&t=15882




回答4:


The answer will be

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

but before that make a ckeditor folder in your application and paste the contents that you have downloaded,



来源:https://stackoverflow.com/questions/3906407/ckeditor-in-asp-net

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!