zoukankan      html  css  js  c++  java
  • ASP.NET MVC 应用程序中使用CKEditor 4 的步骤

    第一步 安装CKEditor 4
    Visual Studio 中选择菜单 工具(&T) - NuGet包管理器(&N) - 管理解决方案的NuGet程序包(&N),在搜索框中输入 CKEditor,找到对应版本进行安装。
    第二步 修改 App_StartBundleConfig.cs

    在合适位置加入如下代码:

    bundles.Add(new ScriptBundle("~/bundles/ckeditor").Include("~/Scripts/CKEditor/ckeditor.js"));
    bundles.Add(new ScriptBundle("~/bundles/ckeditor_config").Include("~/Scripts/CKEditor/config.js"));

    第三步 修改视图:

    在合适位置加入如下代码:

    @Scripts.Render("~/bundles/ckeditor")
    @Scripts.Render("~/bundles/ckeditor_config")

    修改文本编辑框的class属性:

    修改前:@Html.EditorFor(model => model.Description, new { htmlAttributes = new { @class = "form-control" } })

    修改后:@Html.EditorFor(model => model.Description, new { htmlAttributes = new { @class = "ckeditor" } })
    第四步 修改控制器
    将属性修饰[ValidateAntiForgeryToken]修改为[ValidateInput(false)]

    开始使用吧!

  • 相关阅读:
    html笔记3
    html笔记2
    绝望
    HTML中盒子模型
    HTML中visibility:hidden 和 display:none 的区别及实例?
    伪类选择器hover的用法实例
    CSS文本的用法及CSS字体的用法 综合应用
    CSS选择器的分类
    关于CSS的使用方式
    HTML关于表单
  • 原文地址:https://www.cnblogs.com/mercator/p/12356498.html
Copyright © 2011-2022 走看看