views:

2313

answers:

2

How to add FCKEditor in MVC application?

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

+1  A: 

Have a look here: http://www.codeproject.com/KB/aspnet/fckeditor.aspx, this seems to have a great example of what you want.

Steve Haigh
Thanks, Just one problem, It prompt me about potentially dangerous request. on page attribute I put ValidateRequest="false". but still error!
Vikas
Ok solved! I need to put [ValidateInput(false)] In action controller
Vikas
+11  A: 

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.

josh
I also appreciate your answer!
Vikas