Okay, So I have a Kendo Grid where two of the columns are of type date. I want to restrict the entered keys in the date field to only 10 digits. I tried putting @maxlength="10" in HtmlAttributes but it's not working.
But this works when we have an explicit datepicker example:-
@(Html.Kendo().DatePickerFor(x=>x.NotificationDate).Name("NotificationDate").Format("MM/dd/yyyy").Max(DateTime.Today)
.HtmlAttributes(new
{
id = "NotificationDate",
@onkeypress = "return acceptDateFormat(event)",
@onchange = "ValidateDate('NotificationDate', true)",
@maxlength = "10",
@type = "datetime"
}))
Here, it works. But not the place where I want to.
Kindly help me out with this.
What I have tried:
columns.Bound(c => c.DueDate).Title("Due").Format("{0:MM/dd/yyyy}").Width(120).HtmlAttributes(new
{
@onkeypress = "return acceptDateFormat(event)",
@maxlength = "10",
@type = "datetime"
});
columns.Bound(c => c.CompletedDate).Title("Completed").Format("{0:MM/dd/yyyy}").Width(120).HtmlAttributes(new
{
@onkeypress = "return acceptDateFormat(event)",
@maxlength = "10",
@type = "datetime"
});