I currently got following snippet:
@Html.EditorFor(model => model.Street, new { htmlAttributes = new { @class = "form-control tooltp", placeholder = "Rue *", autofocus = "autofocus", data_tooltip_content = "#Street_content" } })
@if (ViewData.ModelState["Street"] != null && ViewData.ModelState["Street"].Errors.Any())
{
<div class="tooltip_templates">
<div id="street_content">
@Html.ValidationMessageFor(model => model.Street)
</div>
</div>
}
How can I make this reusable? Create an MVC helper? Partial view? It's not possible?
I would like to have this kind of solution so that I can use it for all my different fields. I'm using tooltipster for the tooltip messages. Without the if statement, the tooltip will contain an empty string (but will still be shown).
I'd like to have a solution where I can for example do this
@ErrorHelper.ShowError("Street")