调用
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 }
带编号的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>
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。