Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法在我的Html.ValidationSummary()而不是单个错误列表中显示通用的“请更正字段”消息?我正在使用的规范只需要一条通用消息,因为每个字段都有带有错误信息的内联悬停消息。
Html.ValidationSummary()
非常感谢
第一个参数为真,因为我们希望摘要仅显示模型级错误,第二个参数是消息
@Html.ValidationSummary(true, "please correct field")
如果您传递true给Html.ValidationSummary它,则只会在那里显示模型级错误(错误不直接与任何一个字段相关联):
true
Html.ValidationSummary
@Html.ValidationSummary(true)