我有一个模型:
public class MyModel { public string Name {get; set;} public DateTime StartDate {get; set;} }
然后,在我的Razor视图中,我有这个:
@Html.EditorFor(x => x.StartDate,new { @class = "input datepicker" })
但输出的HTML看起来像这样:
<input class="text-Box single-line" data-val="true" data-val-required="The StartDate field is required." id="StartDate" name="StartDate" type="text" value="01/01/0001 00:00:00">
它似乎完全忽略了我的@class定义(以及添加其自己的验证内容)
有没有办法使用我指定的类进行渲染?
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。