I have tried following the Validation Guide and the Batch Editing example but something is still amiss. The validation tooltip does not appear when I attempt to Save Changes after leaving a required field empty (i.e. Rate). We are using ASP.NET MVC 4 Razor and Kendo UI 2014.1.415.
CSHTML
ViewModel (abbreviated with just one field)
I noticed that no validation attributes are being appended to the input field:
What am I missing? What more do you need to see? Thanks.
Adam
CSHTML
@(Html.Kendo().Grid<IncentiveViewModel>() .Name("Incentive") .Columns(columns => { columns.Bound(p => p.Make).EditorTemplateName("MakeDropDown").Sortable(true); columns.Bound(p => p.Model).EditorTemplateName("ModelDropDown").Sortable(true); columns.Bound(p => p.Year).Sortable(true); columns.Bound(p => p.Term); columns.Bound(p => p.Rate); columns.Bound(p => p.StartDate).Format("{0:MM/dd/yyyy}").EditorTemplateName("CalendarPicker"); columns.Bound(p => p.EndDate).Format("{0:MM/dd/yyyy}"); columns.Template(@<text></text>) .Width(110) .ClientTemplate(@"<a class=""k-grid-delete"" href=""\#""></a>"); }) .ToolBar(toolbar => { toolbar.Create().Text("Add Incentive"); toolbar.Save().SaveText("Save Changes").CancelText("Cancel Changes"); }) .Editable(editable => editable.Mode(GridEditMode.InCell)) .Resizable(resize => resize.Columns(true)) .Pageable(pageable => pageable .Refresh(true) .PageSizes(true) .ButtonCount(10)) .Navigatable() .Sortable() .Resizable(resize => resize.Columns(true)) .DataSource(dataSource => dataSource .Ajax() .Batch(true) .PageSize(10) .ServerOperation(false) .Model(model => { model.Id(p => p.IncentiveId); model.Field(p => p.Year).Editable(true); model.Field(p => p.Make).Editable(true); model.Field(p => p.Model).Editable(true); model.Field(p => p.Rate).Editable(true); model.Field(p => p.StartDate).Editable(true); model.Field(p => p.EndDate).Editable(true); }) .Create("Create", "Incentive") .Read("Read", "Incentive") .Update("Update", "Incentive") .Destroy("Destroy", "Incentive")) )ViewModel (abbreviated with just one field)
[Display(Name = "Rate")][Required(AllowEmptyStrings = false, ErrorMessageResourceType = typeof(Resources.Resources), ErrorMessageResourceName = "FieldRequired")][Range(0, 12, ErrorMessage = "Value for {0} must be between {1} and {2}.")]public decimal? Rate { get; set; }I noticed that no validation attributes are being appended to the input field:
<input class="text-box single-line" id="Rate" name="Rate" type="text" value="" data-bind="value:Rate">What am I missing? What more do you need to see? Thanks.
Adam