Completed
Last Updated: 08 Jun 2022 08:11 by ADMIN
Release 2022.R2.SP.next
KM
Created on: 21 Oct 2021 08:22
Category: TextBox
Type: Bug Report
2
TextBoxFor HTML helper does not render "maxlenght" attribute

Bug report

When using the TaxtBoxFor HTML helper and the MaxLength is set via DataAnnotation the maxlength attribute is not rendered.

Reproduction of the problem

Model:

public class MyModel
{
    [MaxLength(5)]
    public string Text { get; set; }
}

View:

@Html.Kendo().TextBoxFor(m => m.Text)

Current behavior

The Telerik UI for ASP.NET Core HTML Helper renders the following markup, without the maxlength attribute:

<span class="k-widget k-textbox" style="">
    <input data-val="true" data-val-maxlength="The field Text must be a string or array type with a maximum length of '5'." data-val-maxlength-max="5" id="Text" name="Text" value="" data-role="textbox" aria-disabled="false" class="k-input" autocomplete="off" style="width: 100%;">
</span>

The default Html.TextBoxFor helper renders the following markup, containing the maxlength attribute:

<input data-val="true" data-val-maxlength="The field Text must be a string or array type with a maximum length of '5'." data-val-maxlength-max="5" id="Text" maxlength="5" name="Text" type="text" value="">

Expected/desired behavior

The Telerik UI for ASP.NET Core HTML Helper should render the maxlength attribute.

Environment

  • Kendo UI version: 2021.3.914
  • Browser: [all]
0 comments