I have a simple view with start and end date, what i am trying to achieve is to show a "Half Day" checkbox if the start date is equal to the end date.
This is what i have tried so far but it's not refreshing the view, since it will get refreshed only on the page load, so i am not able to check if the start date is equal to the end date. What is the best way to show and hide the checkbox?
@Html.FormEditorFor(x => x.StartDate)
@Html.FormEditorFor(x => x.EndDate)
if (Model.StartDate == Model.EndDate)
{
@Html.FormEditorFor(x => x.IsHalfDay, inputClass: "col-sm-1")
}
@Html.FormDropdownFor(x => x.HalfDayAP, ampmDropdown, inputClass: "col-sm-1")
@Html.FormEditorFor(x => x.ReasonForLeave)