Es tut mir leid für meine Frage, aber ich bin neu in MVC.MVC - Wie funktioniert Javascript in Sicht?
Das ist meine Situation.
Aus meiner Sicht, ich habe ein Modell (@model DAEF.Models.M_Generic)
und ich möchte 2 Felder vergleichen. Meine Frage ist, wie kann ich das Javascript
für das tun?
Unter meinem Beispiel Code mit 2 Daten.
@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>
}