如何在 asp.net mvc 中禁用剑道编辑器 [英] How can i disable kendo editor in asp.net mvc

查看:24
本文介绍了如何在 asp.net mvc 中禁用剑道编辑器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何禁用剑道编辑器或使其只读?我尝试使用 HTML 属性但没有运气(或者我仍然做对了)

How can I disable kendo editor or make it read only? I tried using HTML attribute but no luck ( or I still do it right)

                    @(Html.Kendo().Editor()
                    .Name("Text")
                    .Value(@detail.SRoomInformation)
                    .Tools(tools => tools.Clear())
                    )

推荐答案

如果您想知道为什么没有诸如启用/禁用之类的选项 - 因为 html 可以简单地显示为 html 或文本 - 编辑器的所有工具不需要提供,使用这样的小部件毫无意义.编辑器意味着它可以帮助您编辑 ;)

If you are wondering why there is no such option such as Enable/Disable - because html could be simply shown as html or as text - all the tools the Editor provide are not needed and it is pointless to use such widget. Editor means it helps you edit ;)

如果你真的想禁用它,你可以在初始化编辑器后使用以下代码行

If you really want to make it disabled you can use the following line of code after initializing the Editor

例如

@Html.Kendo().Editor().Name("test")


<script type="text/javascript">
    $(function () {
        $($('#test').data().kendoEditor.body).attr('contenteditable', false)
    })        
</script>

这篇关于如何在 asp.net mvc 中禁用剑道编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆