【问题标题】:Set Kendo TextboxFor max length设置剑道文本框最大长度
【发布时间】:2016-07-22 03:20:35
【问题描述】:

我想将文本框的最大长度设置为 5,谁能告诉我该怎么做。

@(Html.Kendo().TextBoxFor(m => m.LstPreEmploymentWorkflowModel.MiddleInitial))

我试过了

@(Html.Kendo().TextBoxFor(m => m.LstPreEmploymentWorkflowModel.MiddleInitial).Name("middlenm")

$("#firstnm").attr('maxlength','5');

但如果我使用 .Name,我会在通过模型传入的控制器中获得中间名的空值。

【问题讨论】:

    标签: asp.net-mvc kendo-asp.net-mvc


    【解决方案1】:

    我相信你只需要这样做:

    @Html.Kendo().TextBoxFor(m => m.LstPreEmploymentWorkflowModel.MiddleInitial)
        .HtmlAttributes(new { style = "width:50px", @maxlength = "5" }).Name("middlenm")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-05
      • 2011-09-02
      • 1970-01-01
      • 2014-06-19
      • 2018-08-31
      • 2012-04-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多