asp.net 中的 ckeditor

发布于 2024-09-27 10:18:04 字数 122 浏览 5 评论 0原文

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

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

我从哪里可以获得组件?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

生活了然无味 2024-10-04 10:18:04

web.config 部分你可以编写:

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

In web.config section you can write:

<add tagPrefix="FredCK" namespace="FredCK.CKEditor" assembly="FredCK.CKEditor, Culture=neutral, PublicKeyToken=9ef91de3e191403a" />
他夏了夏天 2024-10-04 10:18:04

实际上,最好不要使用 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
    }
}

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
    }
}
小霸王臭丫头 2024-10-04 10:18:04

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

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

终遇你 2024-10-04 10:18:04

答案是,

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 文件夹并粘贴您已下载的内容,

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,

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文