开发者

How to integrate CKEditor into Asp.net MVC

Saw this post at CodeProject for FCKEditor. C开发者_如何学编程an someone explain what about the new version?


It's pretty easy to do actually. First download the latest code from the website and extract it to a directory in your project (I choose /Scripts/ckeditor). Then in your view, use the same code as in the "complete sample" in this link and it should work.

Basically, the important steps are:

  1. Make sure you include the ckeditor.js file in the head from your view or in your master page, however you want to do it. This needs to be the exact location within your project (I would use the find file dialog that you can popup when editing a src attribute in visual studio so that it automatically links to the file).
  2. Place the:

    <script type="text/javascript"> CKEDITOR.replace( 'editor1' ); </script>

    RIGHT AFTER your textarea and make sure the id of the textarea is the same in the CKEDITOR.replace() statement.


In MVC, you can not use CKEDITOR.DLL and its tags to, So you need to use ckeditor.js file.

Steps to use CKeditor in MVC3.

  1. Include the ckeditor.js file to the razor page.
  2. And then put CKEDITOR.replace( 'textAreaId' );
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜