1
I’m maintaining a page using Asp.net MVC and using Kendo Asp.Net MVC and I need to make two fields mandatory, but I’m not getting it
index.cshtml:
<div class="col-lg-2 demo-section k-content" id="dayId">
<label class="control-label">@Messages.TotalSwitching_Date - @Messages.TotalSwitching_Start</label>
@(Html.Kendo().DatePicker()
.Name("firstDay")
.Events(e => e.Change("firstDayChange"))
.Start(CalendarView.Month)
.Depth(CalendarView.Month)
.Format("MM dd yyyy")
.HtmlAttributes(new { style = "width: 50%" })
.Value(ViewBag.FirstDate)
.Min(ViewBag.FirstDate)
.Max(ViewBag.LastDate)
)
<label class="control-label">@Messages.TotalSwitching_Date - @Messages.TotalSwitching_End</label>
@(Html.Kendo().DatePicker()
.Name("lastDay")
.Events(e => e.Change("lastDayChange"))
.Start(CalendarView.Month)
.Depth(CalendarView.Month)
.Format("MM dd yyyy")
.HtmlAttributes(new { style = "width: 50%" })
.Max(ViewBag.LastDate)
.Min(ViewBag.FirstDate)
)
</div>
Just define in the model that the attribute cannot be null.
– Vinícius