加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

在ASP.NET MVC 2中集成CKEditor?

发布时间:2020-12-16 09:33:55 所属栏目:asp.Net 来源:网络整理
导读:我想在我的ASP.NET MVC 2应用程序中使用CKEditor作为注释字段,但无法使其工作.这是我有的: 我试图整合编辑器的textarea: div class="editor-field" %: Html.TextAreaFor(model = model.Comment,new { @class = "textarea",@id="Editor1" })% %: Html.Valid
我想在我的ASP.NET MVC 2应用程序中使用CKEditor作为注释字段,但无法使其工作.这是我有的:

我试图整合编辑器的textarea:

<div class="editor-field">
        <%: Html.TextAreaFor(model => model.Comment,new { @class = "textarea",@id="Editor1" })%>
        <%: Html.ValidationMessageFor(model => model.Comment) %>
    </div>

脚本引用头部:

<asp:Content ID="Content3" ContentPlaceHolderID="head" runat="server">
    <script src="../../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script src="../../Scripts/ckeditor/ckeditor.js" type="text/javascript"></script>
    <script src="../../Scripts/ckeditor/adapters/jquery.js" type="text/javascript"></script>
</asp:Content>

文档就绪功能:

<% using (Html.BeginForm())
   {%>
   <script type="text/javascript">
       $(document).ready(function () {
           $('#Editor1').ckeditor();
       });
   </script>

(等等…)
我不知道问题是否与TextareaFor辅助方法有关,我尝试将id设置为Editor1.我对MVC也很陌生,所以我猜这是怎么做的.

无论如何,它不起作用,我会感谢任何关于我做错的建议.

解决方法

好的,我自己找到了答案.看来在同一页面上与另一个jQuery插件存在冲突,所以我需要使用jQuery.noConflict();然后在代码中使用jQuery而不是$. noConflict的位置也很重要.请参阅此网页上的erhard评论: http://devoracles.com/jquery-error-documentready-is-not-a-function-sure

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读