FCKEditor in asp.net-mvc

Vikas picture Vikas · Apr 25, 2009 · Viewed 7.6k times · Source

How to add FCKEditor in MVC application?

How to show database value comes in model, in FCKEditor?

Answer

Josh picture Josh · Apr 27, 2009

That CodeProject website isn't ideal. It asks you to do alot of unneccessary code. All you really need to do is include the correct javascript file:

Then, in the page, render the FCKEditor, given any number of different ways. I prefer to replace a text area:

window.onload = function()
{
    var oFCKeditor = new FCKeditor( 'content' ) ;
    oFCKeditor.ReplaceTextarea() ;
}

At that point, the editor should load just fine. You will probably need to edit the fckeditor configuration files to get the standardized behavior you want. At this point, however, everything should just work. Your FCKEditor instance will behave just like another form field, and you can treat it as such when you get values from it on the server side.

It's very easy to create the server side api's for it to use as well. I created an fckeditor control, and you just need to implement GetFolders, GetFoldersAndFiles, and GetFiles. Those only take a few lines and give you nearly all the functionality you need.

I think it's easier to integrate / customize fckeditor using MVC than it is on Classic ASP.NET.