Whenever I use @Html.EditorForModel(), the one 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 function →
@Html.EditorForModel("MY-TEMPLATE") - I know this function →
@Html.EditorFor(p => p.MY-PROPERTY, "MY-TEMPLATE") - I know this function →
Views\{CONTROLLER}\EditorTemplates\{CLASSNAME\TYPE} - I know this function →
Views\Shared\EditorTemplates\{CLASSNAME\TYPE}
My goal is to change the default template for the whole project!
No need to travel the entire project!
- When used,
@Html.EditorForModel()each property generates customized HTML !!
New template
The new template will look 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>
source
share