I'm developing an ASP.Net core web application and I would like to implements client-side data validation. Is it possible to trigger the asp-validation-for tag helper behavior manually from javascript to show the validation error ? In addition, when I'm returning a view with a Model with errors in ModelState, the span doesn't display error the same way as when the input for Something is empty ( normal way and kendo display). How can I uniformized the display for validation ?
[Required]
public string Something { get; set; }
<span asp-validation-for="Something " class="text-danger"></span>
Edit: I ommit to refer to jquery.validate.min.js and query.validate.unobtrusive.min.js. Moreover, I had problems with validation from dynamic added elements to the DOMS via ajax request (as in jquery-client-side-validation-not-working).
For the second part, I have two different types of validation display (one for (Required attribute) and another one for (Remote attribute). How can I always display the required validation display ?
Here is some code from my ViewModel:
[Required]
[Remote(action: "CheckSomething", controller: "ControllerName")]
public string Something { get; set; }
Here is some code from my View:
@(Html.Kendo().TextBoxFor(model => model.Something ).HtmlAttributes(new { style = "width: 100%" }))
<span asp-validation-for="Something " class="text-danger"></span>