How can I add a required field in edit/create mode? I see that you can enable validation on the grid in the JS examples but I see no direct examples of doing this in the Complete for MVC examples/demos. Essentially I have a drop down list for AdmissionMilestoneID and I want to make it required that the user clicks the drop down and picks a value. I am having issues when setting a default value as it seems to keep triggering the create event after I add the record fully and go to edit a new row. It tries to recreate the new record even though it was already created.
@(Html.Kendo().Grid(Model.federationMilestones)
.Name("AdmissionMilestones")
.Columns(columns => {
columns.ForeignKey(p => p.AdmissionMilestoneID, Model.academicMilestones, "AdmissionMilestoneID", "MilestoneName")
.Title("Milestone");
columns.Bound(p => p.IsKeyMilestone);
columns.Bound(p => p.RecieveReminders);
columns.Bound(p => p.StudentRelativeDeadline);
})
.ToolBar(toolbar =>
{
toolbar.Save();
toolbar.Create();
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Sortable()
.Reorderable(reorder => reorder.Columns(true))
.Resizable(resize => resize.Columns(true))
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.ServerOperation(false)
.Events(events => events.Error("error_handler"))
.Model(model =>
{
model.Id(p => p.AdmissionMilestoneID);
model.Field(p => p.MilestoneName).Editable(false);
model.Field(p => p.FederationID).DefaultValue(Model.FederationID);
})
.Update("Editing_Update_Milestones", "Admin")
.Create("Editing_Add_Milestones", "Admin")
)
)