When using the TaxtBoxFor HTML helper and the MaxLength is set via DataAnnotation the maxlength
attribute is not rendered.
Model:
public class MyModel
{
[MaxLength(5)]
public string Text { get; set; }
}
View:
@Html.Kendo().TextBoxFor(m => m.Text)
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="">
The Telerik UI for ASP.NET Core HTML Helper should render the maxlength
attribute.