标签: meta-attribute

调用EditorFor(...)时隐藏公共属性的编辑标签?

在调用时Html.EditorFor(m => m),m具有公共属性的公共类在哪里,为具有该属性的属性显示隐藏的输入和标签[HiddenInput].

  • 如何隐藏标签而不将其设为私有或创建编辑器模板?

public class User
{
    [HiddenInput]
    public Guid ID { get; set; } // should not be displayed in editor template
    public string Name { get; set; } // should be editable
}
Run Code Online (Sandbox Code Playgroud)

EditorFor(...) 标签的ID属性不受欢迎的结果

<div class="editor-label">
    <label for="ID">ID</label> <!-- Why is this here? -->
</div>
<div class="editor-field">
    <input id="ID" name="ID" type="hidden" value="">
</div>
Run Code Online (Sandbox Code Playgroud)

meta-attribute editorfor editorformodel asp.net-mvc-2

6
推荐指数
1
解决办法
3516
查看次数