Home > DeveloperSection > Forums > How to use ckeditor in mvc.
Pawan Shukla

Total Post:37

Points:267
Posted on    September-30-2016 10:54 PM

 C# JQuery  Mvc 
Ratings:


 1 Reply(s)
 309  View(s)
Rate this:
We want to use  ckeditor .js in mvc project please help me. 


aditya kumar Patel

Total Post:250

Points:1782
Posted on    September-30-2016 10:58 PM

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");
        }

    }
}



Don't want to miss updates? Please click the below button!

Follow MindStick