我使用Telerik Kendo UI编辑器可以发布到服务器的字段。如何在使用Html.Kendo()时在Jquery中选择编辑器EditorFor
@(Html.Kendo().EditorFor(model => model.TickerContent)
.Name("TickerContent")
.Encode(true)
.HtmlAttributes(new { style = "width:100%;height:440px" }))
在窗体的同一页上,我有一个我希望能够编辑的项目列表,所以我需要设置编辑器的值。演示代码使用下面的代码来获取和设置编辑器的值:
<script>
$(document).ready(function() {
var editor = $("#Editor").data("kendoEditor");
var setValue = function() {
editor.value($("#value").val());
};
$("#get").click(function() {
alert(editor.value());
});
$("#set").click(setValue);
});
</script>
变量编辑器的值总是不确定的。我的问题是我如何获得并设置编辑器值?我试过var editor = $(“#TickerContent”)。data(“kendoEditor”);但编辑仍然未定义。
检查编辑器的“id”HTML属性(在最终输出中)。 – 2013-03-20 09:49:16