user6838820
user6838820

Reputation:

How to make validation summary show red text and make bullet point not show?

Just a quick question, I want to make the bullet point not show on my validation summary and also I want to make the text red. I was just wondering how to do this, please check my code below.

<div class="help-block col-md-12" style="list-style-type:none">
@Html.ValidationSummary(true)
</div>

Upvotes: 2

Views: 4002

Answers (1)

xxxmatko
xxxmatko

Reputation: 4142

Change your call of ValidationSummary extension method like this:

@Html.ValidationSummary(true, "", new { @class = "custom-validation-summary" })

It will add the css class custom-validation-summary to the rendered html element which represents the summary, and than you can change the look with css:

<style>
.custom-validation-summary ul {
   list-style-type:none;
   color: red;
   padding: 0;
}
</style> 

Here is simple MVC fiddle https://dotnetfiddle.net/wTZbmb

Upvotes: 4

Related Questions