vendredi 2 février 2018

HtmlAttributes not working for boolean property ASP.NET MVC

I've a model with a boolean property:

    public bool IsWorking{ get; set; }

In the view I'm using:

@Html.EditorFor(m => m.IsWorking, new BaseAdditionalData() { HtmlAttributes = new Dictionary<string, object> { { "id", "IsWorkingCustom" }, { "name", "IsWorkingCustom" } } })

but the rendered HTML of the checkbox contains id="IsWorking" name="IsWorking", so nothing changed.




Aucun commentaire:

Enregistrer un commentaire