Srivastava
Srivastava

Reputation: 3578

ckeditor in asp.net

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?

Upvotes: 1

Views: 3428

Answers (4)

Peter Huber
Peter Huber

Reputation: 3312

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

Upvotes: 1

Srivastava
Srivastava

Reputation: 3578

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,

Upvotes: 0

Myra
Myra

Reputation: 3656

In web.config section you can write:

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

Upvotes: 2

citronas
citronas

Reputation: 19365

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

Upvotes: 0

Related Questions