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.
The TextBox TagHelper does not render the maxlength and placeholder attributes when set via data annotations.
For a model property defined the following way
[Display(Name = "Example", Prompt = "Example Prompt")]
[StringLength(maximumLength : 5, MinimumLength = 1, ErrorMessage = "Must be between 1 and 5")]
public string Example { get ; set ; }
the TextBox TagHelper generetes
<input
class="form-control k-input-inner"
data-val="true"
data-val-length="Must be between 1 and 5"
data-val-length-max="5"
data-val-length-min="1"
id="Example"
name="Example"
value=""
data-role="textbox"
style="width: 100%;"
aria-disabled="false"
autocomplete="off"
aria-invalid="true"
aria-describedby="Example_validationMessage">
when the default ASP.NET Core TagHelper generates markup containing the maxlength and placeholder attributes:
<input
class="form-control k-invalid"
type="text"
data-val="true"
data-val-length="Must be between 1 and 5"
data-val-length-max="5"
data-val-length-min="1"
id="Example"
maxlength="5"
name="Example"
placeholder="Example Prompt"
value=""
aria-invalid="true"
aria-describedby="Example_validationMessage">
The maxlength and placeholder attributes are set to the generated input element.
Link do not appear properly in a TagHelper menu that uses asp-action and asp-controller. In version 2.1 the application crashes
<menu-item text="Furniture">
<sub-items>
<menu-item text="Tables & Chairs" asp-action="About" asp-controller="Home" ></menu-item>
</sub-items>
</menu-item>
Microsoft Tag Helpers should create a working anchor tag