简体   繁体   中英

Html.EditorFor Global Template?

Is there any way to define a global template for the Html.EditorFor helper?

I would like to alter the markup that is output so that for example instead of rendering

<div class="editor-label">
  <label .../>
</div>
<div class="editor-field">
  <input .../>
</div>

It would render:

<div>
    <div class="label"><label..../></div>
    <div class="field"><input..../></div>
</div>

This is for when I'm using Html.EditorFor with an object instance not just an object property.

Brad Wilson has written a blog series on asp.net mvc 2 templates. This one is related to your problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM