vendredi 11 décembre 2015

How to popup alert when TextBoxFor's input does not exist in database?

NPG_Chemical_Measurement_Methods is a ICollection type. In my Chemical.cshtml, I have:

<div id="nioshs">
    @Html.EditorFor(model => model.NPG_Chemical_Measurement_Methods)
</div>

and in the EditorTemplate view:

<div class="method" style="display:inline-block;">
<p>
    @Html.RemoveLink("x", "div.method", "input.mark-for-delete")
    @Html.HiddenFor(x => x.DeleteMethod, new { @class = "mark-for-delete" })
    @Html.TextBoxFor(x => x.Measurement_Method)
    @Html.Hidden("Measurement_Type", "NIOSH")
    &nbsp;&nbsp;&nbsp;
</p>
</div>

I want to have something like when I give input for "@Html.TextBoxFor(x => x.Measurement_Method)", then click on other place of the current page, an alert will popup says "Not exist in Database" if record cannot be found in "Measurement_Method" table.

Aucun commentaire:

Enregistrer un commentaire