Hi I have a disable or read only issue with Kendo editor in my c# MVC project :
@(Html.Kendo().EditorFor(m => m.Other_Areas)
.Name("Other_Areas")
.Encode(false)
.Tools(tools => tools
.Clear()
.Bold().Italic().Underline().Strikethrough().JustifyLeft().JustifyCenter().JustifyRight().JustifyFull().InsertUnorderedList().InsertOrderedList().Outdent().Indent()
.CreateLink().Unlink().InsertImage().InsertFile().SubScript().SuperScript().TableEditing().ViewHtml()
)
.HtmlAttributes(new { @class = "form-control" }))
Currently I have @Html.TextAreaFor(m => m.Other_Areas, new { @class = "form-control" }) and "clicking "View" link calls a function called
enableControls() { document.getElementById('Other_Areas').disabled = false;} this is just working fine. Now that I have replaced with Html.Kendo().EditorFor none of the following works:
//var cteditor = $("#Other_Areas").data("kendoEditor"),
//editorBody = $(cteditor.body);
//editorBody.removeAttr("contenteditable").find("a").on("click.readonly", false)
//$($("#Other_Areas").data().kendoEditor.body).attr("contenteditable",false);
//$("#Other_Areas").css("z-index", 2);
//$('Other_Areas').contents().find("body").attr('contenteditable', false);
//$('.k-editor-toolbar').hide();
//$('#Other_Areas').attr('disabled', true);
//$($("#Other_Areas").data().kendoEditor.body).attr("contenteditable", false);
//$('#Other_Areas').data('kendoEditor').contentEditable(false);
//$($('#Other_Areas').body).attr('contenteditable', false);
//var cteditor = $("#Other_Areas").data().kendoEditor;
//var editorBody = $(cteditor.body);
//editorBody.attr("contenteditable", false);
// $("#Other_Areas").data("kendoEditor").disable = true;
//$('.k-editor textarea').each(function (idx, element) {
// $($(element).data("kendoEditor").body).attr("contenteditable", false);
//});
$(editor.body).attr('contenteditable',false);
$('.k-editor textarea').each(function (idx, element) {
$($(element).data("kendoEditor").body).attr("contenteditable", false);
});
Currently I am using Kendo.mvc.dll version 2020.1.406.545
I tried several samples (http://dojo.telerik.com/oMaDAZ etc) and it seems all are version specific. If I download as a seperate html/app it just works fine. Its not working in my application. I tried to add external references listed in example but my application throws multiple error stating that auto populate, date control etc are not working or Jquery not defined etc. May be because, I already have 2020 version kendo.mvc.dll locally and in addition if I add, the duplicate references leading to this error.
Please advise on how to completely disable the Html.Kendo().EditorFor(m => m.Other_Areas) including the tools disabling like https://dojo.telerik.com/@NeliKondova/urIZAZAy
Please advise.
Many thanks,
Swati