Adding style to Editor For

前端 未结 5 1099
独厮守ぢ
独厮守ぢ 2020-12-18 21:48

I\'m trying to apply a Style to the Editor for an element, but I can\'t make it work; what am I doing wrong?

@Html.EditorFor(model => model.ClienteNuevo)
         


        
5条回答
  •  悲哀的现实
    2020-12-18 22:17

    EditorFor invokes template views rather than outputting a fixed element, so it doesn't take html attributes as an argument. For something like what you're doing the easiest workaround would be to surround the editor and validation message with another element, and apply the style to that instead:

    @Html.EditorFor(model => model.ClienteNuevo) @Html.ValidationMessageFor(model => model.ClienteNuevo,"")

提交回复
热议问题