【问题标题】:Kendo MVC Grid Numeric TextboxKendo MVC 网格数字文本框
【发布时间】:2017-12-31 12:38:57
【问题描述】:

我尝试在网格中显示数字文本框。我的数据是 int,但不像 Telerik 中的演示那样显示。我使用了客户端模板,但此时网格在同一个单元格中有两个输入。

当我使用模板的任何属性时,它会显示为这样。

这里是代码;

 columns.Bound(c => c.MAX_DOSYA_BOYUT)

当我使用自定义模板时,它显示如下

这里是代码;

   columns.Bound(c => c.MAX_DOSYA_BOYUT).Template(@<text></text>).ClientTemplate(

            Html.Kendo().NumericTextBox<int>()
                .Name("order_#=URETIM_YERI#")
                .HtmlAttributes(new { value = "#=MAX_DOSYA_BOYUT #", @class = "k-numerictextbox", style = "width:100%" })
                .Min(0)
                .Max(100000)
                .Step(1)
                .Decimals(0)
                .ToClientTemplate().ToHtmlString());

它必须看起来像这个链接

telerik kendo editing

我做错了什么?

谢谢...

【问题讨论】:

    标签: model-view-controller kendo-ui textbox telerik numeric


    【解决方案1】:

    首先,确保 ~Views/Shared/EditorTemplates 目录包含预定义的 kendo ui mvc 编辑器模板。如果没有 - 从您的 kendo ui mvc 安装的 wrappers/aspnetmvc/EditorTemplates 文件夹中复制它们。

    列绑定设置:

    columns.Bound(c => c.NumberTest).EditorTemplateName("Integer");
    

    Editor 模板名称“Integer”对应于 EditorTemplate 目录中的 Integer.cshtml 模板。结果 - 完全主题的小部件。

    【讨论】:

    • 谢谢,这是我需要的:)
    猜你喜欢
    • 2012-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多