简体   繁体   English

Html.EditorFor Global Template?

[英]Html.EditorFor Global Template?

Is there any way to define a global template for the Html.EditorFor helper? 有没有办法为Html.EditorFor帮助器定义全局模板?

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. 这是因为当我使用Html.EditorFor时,对象实例不仅仅是对象属性。

Brad Wilson has written a blog series on asp.net mvc 2 templates. Brad Wilson撰写了一篇关于asp.net mvc 2模板的博客系列 This one is related to your problem. 这个与你的问题有关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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