Whenever I use @Html.EditorForModel()
following the standard template is displayed in asp.net mvc
Default in Asp.net MVC template
<div class="editor-label">
<label for="[MY-PROPERTY]">MY-PROPERTYNAME</label>
</div>
<div class="editor-field">
<input id="[MY-PROPERTYID]" name="MY-PROPERTYNAME" type="text" value="">
<span class="field-validation-valid" data-valmsg-for="MY-PROPERTYNAME" data-valmsg-replace="true"></span>
</div>
I would like to customize the format of this HTML!!
But attention!!!!!
- I know this feature ->
@Html.EditorForModel("MY-TEMPLATE")
- I know this feature ->
@Html.EditorFor(p => p.MY-PROPERTY, "MY-TEMPLATE")
- I know this feature ->
Views\{CONTROLLER}\EditorTemplates\{CLASSNAME\TYPE}
- I know this feature ->
Views\Shared\EditorTemplates\{CLASSNAME\TYPE}
My goal is to modify the default template for the entire project!
Without having to travel the entire project for this!
- When using
@Html.EditorForModel()
, each property will generate a HTML customized!!
New template
The new template would be something like this:
<div class="control-group">
@Html.LabelFor(p => p.PROPERTY, new { @class = "control-label" })
<div class="controls">
@Html.EditorFor(p => p.PROPERTY)
<span class="help-inline"></span>
</div>
</div>