asp.net mvc - asp-validation-summary works, field validation does not work -
i have added validation on view models this:
parentviewmodel.cs
public childmodel cm { get; set; }
childviewmodel.cs
[required(errormessage = "Изберете честота")] public int? sid { get; set; } public list<selectedlistitem> ? sid { get; set; }
in razor views have added fields this:
---- view (parentviewmodel) ----
<div asp-validation-summary="all" class="text-danger"></div>
---- partialview (childviewmodel) ----
<label asp-for="@model.sid">Честота:</label> <select asp-for="@model.sid" asp-items="model.sids" class="form-control" id="js-frequency"> <option value = "" selected>-- select --</option> </select> <span asp-validation-for="@model.sid" class="text-danger"></span>
problem: when submit form (using jquery $.post
) errors displayed in asp-validation-summary never display error messages in corresponding asp-validation-for span element.
i consider solution book cant figure out why happens, kindly ask has experienced kind of problem point me towards possible solution , explain problem.
i use aspnetcore.mvc 1.1.3
Comments
Post a Comment