Click here to Skip to main content
12,760,727 members (27,556 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


15 bookmarked
Posted 21 Jan 2013

How to Integrate CKEditor with ASP.NET

, 22 Jan 2013 CPOL
Rate this:
Please Sign up or sign in to vote.
This is meant for easy integration of CKEditor with ASP.NET


CKEditor is one of the most popular web text editors nowadays. Here is the official Site of CKEditor. Usually, we use this tool for easy and friendly back end data entry. This tool is rapidly used for composing email messages. On the other hand, CKEditor is an open source application, which means it can be modified any way we want. So I found it very useful for our day to day practice. Today, I am going to describe an easy way to integrate CKEditor with ASP.NET web projects.


As a web developer, I found that I am using CKEditor on a regular basis. Each time, I was getting into some trouble that took my work hour unnecessarily. That's why I made a decision to find an easy way to integrate this useful tool with my ASP.NET web projects.

Points of Interest

I think this will be interesting and time consuming for CMS type data entry where CKEditor is quite often used. As this process can be used easily and it supports easy integration between different projects, programmers will be helped a lot.

Using the Code

Try the following easy steps to complete the task.

  1. Open New Project [File->New->Project-> ASP.NET Empty Web Application]
  2. Name the Project as you like, I named it "TestCkEditor"
  3. Download the attached Zip file ( and extract.
  4. You will find a bin folder when you extract the
  5. Go to the Solution explorer

    Mouse Click -> Add References->Browse-> Then browse the bin folder of the extracted ( -> Select The Two DLLs
    (CKEditor.dll & CKEditor.Net.dll)->OK]

  6. There is a folder called ckeditor in small caps. Find the folder. This folder contains all necessary files (.js , .css, images, themes, etc. that are necessary for successful integration of this tool.
  7. Copy this folder and paste it in your project.
  8. Then add a new aspx page to the project.
  9. Then write this single line of code just before the HTML tag of your .aspx page. This block of line will register the DLL file that you have just added & using the "TagPrefix" will call the CKEditorControl. Here the BasePath is the folder you have just added which contains all necessary files to load the CKEditor.
    <%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
  10. Then add this div inside of the form tag of your aspx page and we are done.
       <CKEditor:CKEditorControl ID="CKEditor1" BasePath="/ckeditor/" runat="server">
  11. Build the project and then run. You will find CKEditor with full features at your screen. Then customize as per your requirements.

Here is the back end code under button click.

HtmlEncode and HtmlDecode are useful ways to use in here. HTML encoding makes sure that text is displayed correctly in the browser and not interpreted by the browser as HTML. For example, if there is a string in the CKEditor which contains a less than sign (<) or greater than sign (>), the browser would interpret these characters as the opening or closing bracket of an HTML tag. When the characters are HTML encoded, they are
converted to the strings &lt; and&gt;, which causes the browser to display the less than sign and greater than sign correctly.

protected void Button1_Click(object sender, EventArgs e)
            string str = CKEditor1.Text;
            string str1 = Server.HtmlEncode(str);
            string str2 = Server.HtmlDecode(str);
            lblText.Text = str2;

On the other hand, Html Decoding does not convert any tag to string. It simply interprets your input into plain HTML.

Here is an example:

There is a paragraph in the CKEditor. So the HtmlDecode converts into a plain HTML. On the other hand, HtmlEncode converts them into string.

So now I think you will find it easier to work with CKEditor.

Happy coding.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer Cefalo
Bangladesh Bangladesh

I am Palash Debnath. I have been working on windows technologies since 2008. I started with ASP.NET. Then I moved to Windows Form and from the last year I have been working with Windows 8 app development. My future plan is to work with Windows 10 app development as well. I have completed my Undergraduate from Khulna University of Engineering in Computer Science & Engineering. Now I am working as a Software Engineer at Cefalo on Windows 8 app development.

You may also be interested in...

Comments and Discussions

QuestionThank you Pin
lmickelb13-Apr-16 12:00
memberlmickelb13-Apr-16 12:00 
Questionhow to save the data in richtextbox to openoffice using web application c# and asp .net Pin
Member 1232452323-Feb-16 1:46
memberMember 1232452323-Feb-16 1:46 
PraiseThanks Pin
Member 1212922610-Nov-15 6:51
memberMember 1212922610-Nov-15 6:51 
GeneralCk Editor Pin
Aditya Chauhan8-Jun-15 7:28
memberAditya Chauhan8-Jun-15 7:28 
Questionworking in ckeditor Pin
Member 114519401-Jun-15 0:09
memberMember 114519401-Jun-15 0:09 
QuestionCan't find dll's Pin
Member 1163348322-Apr-15 6:45
memberMember 1163348322-Apr-15 6:45 
Generalregarding uploading image Pin
Member 1102782017-Apr-15 2:10
memberMember 1102782017-Apr-15 2:10 
Generalregarding uploading image Pin
Member 1102782017-Apr-15 2:09
memberMember 1102782017-Apr-15 2:09 
QuestionCould not load file or assembly 'CkEditor' or one of its dependencies. Pin
kk20144-Jan-15 20:16
groupkk20144-Jan-15 20:16 
AnswerRe: Could not load file or assembly 'CkEditor' or one of its dependencies. Pin
Member 1102782017-Apr-15 4:03
memberMember 1102782017-Apr-15 4:03 
GeneralRe: Could not load file or assembly 'CkEditor' or one of its dependencies. Pin
Member 1163348322-Apr-15 6:47
memberMember 1163348322-Apr-15 6:47 
QuestionCKEditor page in flashing (flickering) Pin
kesav prakash13-Dec-14 2:07
memberkesav prakash13-Dec-14 2:07 
QuestionAutogrow? Pin
todavidhardy1-Jul-14 15:50
membertodavidhardy1-Jul-14 15:50 
Newshh Pin
Member 1038689914-Feb-14 5:10
memberMember 1038689914-Feb-14 5:10 
Questionlicensing Pin
Member 103320251-Nov-13 9:06
memberMember 103320251-Nov-13 9:06 
AnswerRe: licensing Pin
dpalash2-Nov-13 8:57
professionaldpalash2-Nov-13 8:57 
Questionhow to store the dynamic rich text data from CKEditor in ASP.Net Pin
Arsh Pareek2-Oct-13 3:54
memberArsh Pareek2-Oct-13 3:54 
AnswerRe: how to store the dynamic rich text data from CKEditor in ASP.Net Pin
dpalash3-Oct-13 0:00
professionaldpalash3-Oct-13 0:00 
GeneralRe: how to store the dynamic rich text data from CKEditor in ASP.Net Pin
Arsh Pareek3-Oct-13 1:33
memberArsh Pareek3-Oct-13 1:33 
SuggestionBetter way to use CKEditor with ASP.NET Pin
Peter Huber SG8-Jul-13 17:47
memberPeter Huber SG8-Jul-13 17:47 
GeneralRe: Better way to use CKEditor with ASP.NET Pin
dpalash8-Jul-13 22:53
professionaldpalash8-Jul-13 22:53 
GeneralRe: Better way to use CKEditor with ASP.NET Pin
Rahul Dihora RV4-Aug-14 4:09
memberRahul Dihora RV4-Aug-14 4:09 
GeneralRe: Better way to use CKEditor with ASP.NET Pin
TecNQ25-Oct-16 20:34
professionalTecNQ25-Oct-16 20:34 
Questionhow could i modify it Pin
equeramullah bughio11-Apr-13 22:25
memberequeramullah bughio11-Apr-13 22:25 
QuestionPublishing Asp .net File which contain CKEditor Pin
itsureshuk9-Apr-13 1:34
memberitsureshuk9-Apr-13 1:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170217.1 | Last Updated 22 Jan 2013
Article Copyright 2013 by dpalash
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid