Show ValidationSummary MVC3 as “alert-error” Bootstrap

后端 未结 16 955
情书的邮戳
情书的邮戳 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:42

    edited again

    I misunderstood your question at first. I think the following is what you want:

    @if (ViewData.ModelState[""] != null && ViewData.ModelState[""].Errors.Count > 0)
    { 
        
    @Html.ValidationSummary(true, "Errors: ")
    }

提交回复
热议问题