How to extend the ValidationSummary HTML Helper in ASP.NET MVC?

后端 未结 4 496
北恋
北恋 2020-12-03 02:13

I need to wrap the Validation Summary in a div. How do I set the Validation Summary to wrap it with a div when errors are present?

4条回答
  •  臣服心动
    2020-12-03 02:35

    What you can do is this :

    <%if (!ViewData.ModelState.IsValid) { %>
    
    <%= Html.ValidationSummary( "Login was unsuccessful. Please correct the errors and try again.") %>
    <% } %>

提交回复
热议问题