Tuesday, April 10, 2012

How to include TinyMCE editor in ASP.NET MVC 3 razor view?

- Download the latest version from: http://www.tinymce.com/download/download.php
- Extract JavaScript folder into a folder under Scripts, and include files into MVC project
- Copy and Paste following code into the view you want to use

<script type="text/javascript" src='@Url.Content("~/Scripts/tiny_mce/tiny_mce.js")'></script>
<script type="text/javascript">
    tinyMCE.init({
        mode: "textareas"
    });
</script>
<form method="post" action="somepage">
<textarea name="content" style="width: 100%"></textarea>
</form>


- Most important thing: double check the path (JavaScript file tiny_mce.js) is correct
References for HTML editor:
HTML eidtor:
http://ckeditor.com/demo
http://www.tinymce.com/tryit/full.php
http://drupal.fckeditor.net/demo
http://www.webdesignerdepot.com/2008/12/20-excellent-free-rich-text-editors/
http://blogs.planetcloud.co.uk/mygreatdiscovery/post/Using-CKEditor-and-TinyMCE-with-ASPNET-MVC.aspx

3 comments: