我有如下其定义一个剑道编辑:保存文本从剑道编辑数据库
@(Html.Kendo().Editor()
.Name("myEditor")
.Tag("div")
.Tools(tools => tools
.Clear()
.Bold()
.Italic()
.Underline()
.Strikethrough()
.JustifyCenter().JustifyFull().JustifyLeft().JustifyRight()
.CreateLink().Unlink().TableEditing().FontColor().BackColor())
.Value(@<text>
Hello Kendo Editor <some text with html tags here>
</text>)
)
然后,我有两个按钮,显示只为管理员 - 保存和编辑,他们被定义为下面 -
<button type="button" id="btnedit">Edit</button>
<input type="submit" name="btnSave" id="btnSave" value="Save" class="btn btn-default" />
还有其他两种形式提交按钮如下图所示 -
<input type="submit" name="btnAgree" id="btnAgree" value="Agree" class="btn btn-primary" />
<input type="submit" name="btnDisagree" id="btnDisagree" value="Disagree" class="btn btn-default" />
而且FO RM处理提交的同意并通过BeginForm不同意按钮(“ActionMethod”,“控制器”,FormMethod.Post)像下面 -
@using (Html.BeginForm("Index", "MyControllerName", FormMethod.Post))
现在我想的是,当一个管理员用户进来,使得变化到编辑器文本并点击'保存'按钮,我希望编辑器的文本保存在数据库中。我可以处理保存部分。我只想知道,我如何从Kendo Editor获取文本并将文本值发送到控制器中的操作方法。
我想在这个线程这里提供的解决方案 - http://www.telerik.com/forums/save-changes-to-and-print-content-of-editor-in-mvc
因此,使用该解决方案在这里我添加了一个操作方法类似的编辑器名称,如下面的字符串参数名称 -
public ActionResult Save(string myEditor) {
// TO DO: Save the text to the database
}
当我运行我的应用程序,并点击“保存”按钮,我得到下面的错误 -
HTTP Error 404.0 - Invalid navigation The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
它不打“保存”操作方法。我如何得到这个工作?
感谢
谢谢@Sandman的回答。我尝试了上面的方法,但是当它试图从Kendo Editor获取值时,我收到了Javascript错误。 0x800a138f - JavaScript运行时错误:无法获取未定义或空引用的属性“值” – Kristy
确保您正在访问[现有实例](http://docs.telerik.com/aspnet-mvc/helpers/editor/overview#existing -instances)在你的MVC声明之后。 – Sandman