Show ValidationSummary MVC3 as “alert-error” Bootstrap

后端 未结 16 1196
情书的邮戳
情书的邮戳 2021-01-30 00:51

I want to show a ValidationSummary mcv3 with \"alert-error\" Bootstrap styling.

I\'m using a Razor view, and I show model errors with this code:

 @Html.V         


        
16条回答
  •  误落风尘
    2021-01-30 01:20

    TwitterBootstrapMVC takes care of this one with just one line:

    @Html.Bootstrap().ValidationSummary()
    

    Important, to assure that it behaves the same during the server side and client side (unobtrissive) validation, you need to include a javaScript file that takes care of that.

    You can customize your Validation helper with extension methods however you see fit.

    Disclaimer: I'm the author of TwitterBootstrapMVC. Using it with Bootstrap 3 requires a license.

提交回复
热议问题