Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add a css class or id name to Html.ValidationSummary

I would like to wither add an additional CSS class or give an ID to my @Html.ValidationSummary() tag. I tried the new keyword like I would with other HTML Helpers but gives an anonymous type to string conversion error. Is this possible to do and if so how?

@Html.ValidationSummary(false, new { @id = "validationSummary" })
like image 626
Matthew Verstraete Avatar asked Oct 18 '25 19:10

Matthew Verstraete


1 Answers

There is no method overload for Html.ValidationSummary that receives (Boolean, Object). There is one that receives (Boolean, String, Object) though.

You could try this:

@Html.ValidationSummary(false, "", new { @id = "validationSummary" })
like image 59
Carlos Figueroa Avatar answered Oct 20 '25 17:10

Carlos Figueroa