日期:2014-05-17  浏览次数:20462 次

ASP.NET MVC3 使用kindeditor编辑器获取不到值
ASP.NET MVC3 使用kindeditor编辑器的时候,textarea里的值一直为空,获取不到内容。我写的代码如下:
前台:

@model Jyson.ZhanShiQuan.Model.NoticeHelp
@{
    ViewBag.Title = "AddNotice";
    Layout = "~/Views/Shared/_Admin.cshtml";
}
<script src="../../../../kindeditor/kindeditor.js" type="text/javascript"></script>
<link href="../../../../kindeditor/themes/default/default.css" rel="stylesheet" type="text/css" />
<script src="../../../../kindeditor/lang/zh_CN.js" type="text/javascript"></script>
<script src="../../../../kindeditor/plugins/code/prettify.js" type="text/javascript"></script>
<link href="../../../../kindeditor/plugins/code/prettify.css" rel="stylesheet" type="text/css" />
<script>
    KindEditor.ready(function (K) {
        var editor1 = K.create('#editor', {
            cssPath: '../../../../kindeditor/plugins/code/prettify.css',
            uploadJson: '../../../../kindeditor/asp.net/upload_json.ashx',
            fileManagerJson: '../../../../kindeditor/asp.net/file_manager_json.ashx',
            allowFileManager: true
        });
    });
</script>
<div id="frameBox">
    <div class="frameTitle">
        添加公告</div>
    <div class="frameBody">
        @using (Html.BeginForm("AddNotice", "NoticeHelp", FormMethod.Post, new { @id = "frmSubmit" }))
        {
            <p>
                @Html.LabelFor(model => model.NoticeHelpName, "公告标题:")
                @Html.EditorFor(model => model.NoticeHelpName)
                @Html.ValidationMessageFor(model => model.NoticeHelpName)
            </p> 
            <p>
                @Html.LabelFor(model => model.Content, "内容:")
                @Html.TextAreaFor(model => model.Content, new { id = "editor", rows = "15", cols = "85" })
                @Html.ValidationMessageFor(model => model.Content)
                @* @Html.TextArea("editor", new { rows = "5", style = "width:750px;height: 500px;", @id = "editor" })*@