HOW TO USE CKEDITOR IN MVC.

Pawan Shukla

Total Post:38

Points:274
Posted by  Pawan Shukla
JQuery  Mvc 
C#
 774  View(s)
Ratings:
Rate this:
We want to use  ckeditor .js in mvc project please help me. 
  1. aditya kumar Patel

    Post:254

    Points:1810
    Re: How to use ckeditor in mvc.

    i hope this will  help for you. 

    @{
        ViewBag.Title = "Index";
    }
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script src="http://cdnjs.cloudflare.com/ajax/libs/ckeditor/4.2/ckeditor.js"></script>
    <script src="http://cdnjs.cloudflare.com/ajax/libs/ckeditor/4.2/adapters/jquery.js"></script>
    @using (Html.BeginForm("Index","Home",FormMethod.Post))
    {
    <div style="width:1000px;">
        <textarea name="TextArea1" id="TextArea1" cols="20" rows="2"></textarea>
    </div>
        <input id="Submit1" type="submit" value="submit" />
    }
    
    <script> 
        $('#TextArea1').ckeditor({
            height: "300px",
            toolbarStartupExpanded: true,
            width: "100%"
        }); 
       
    </script>
    

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    
    namespace Forum.Controllers
    {
        public class HomeController : Controller
        {
            public ActionResult Index()
            {
                return View();
            }
    
            [HttpPost, ValidateInput(false)]
            public ActionResult Index( FormCollection form)
            {
    
                var data = form["TextArea1"];
    
                return View("Index");
            }
    
        }
    }
    


Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!