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)]

    开始使用吧!

  • 相关阅读:
    迭代器
    关于文章cisco漏洞4786
    Python学习目录
    Python的xml模块
    【JS30】Event Capture, Propagation, Bubbling and Once
    mysql安装
    CS193P 第四课笔记 · Hexo
    CSS变量
    在CentOS7上开启和挂载NFS共享
    《Android 编程实战》Chap5_重识IPC
  • 原文地址:https://www.cnblogs.com/mercator/p/12356498.html
Copyright © 2011-2022 走看看