I'm sorry for my question, but I'm new in MVC.
This is my situation.
In my view, I have a Model (@model DAEF.Models.M_Generic)
and I want to compare 2 fields. My question is, how can I use the javascript
for do that ?
Below my example code with 2 dates.
@model DAEF.Models.M_Generic
<script type="text/javascript">
function CompareDate() {
var dSart = "<%=model.Dat_Start%>";
var dEnd = "<%=model.Dat_End%>";
if (dEnd > dSart) {
alert("Date One is greather then Date Two.");
}
}
CompareDate()
</script>
@using (Html.BeginForm("Ask_History", "Corr_Exit"))
{
@Html.AntiForgeryToken()
<div class="row">
@Html.LabelFor(model => model.Dat_Start, new { @class = "control-label col-sm-2" })
<div class="col-sm-3">
@Html.TextBoxFor(model => model.Dat_Start, new { @class = "DateTimePicker form-control" })
@Html.ValidationMessageFor(model => model.Dat_Start, "", new { @class = "text-danger" })
</div>
@Html.LabelFor(model => model.Dat_End, new { @class = "control-label col-sm-2" })
<div class="col-sm-3">
@Html.TextBoxFor(model => model.Dat_End, new { @class = "DateTimePicker form-control" })
@Html.ValidationMessageFor(model => model.Dat_End, "", new { @class = "text-danger" })
</div>
</div>
}