ASP.net MVC ValidationSummary always being rendered
Asked Answered
R

1

5

I've added an ASP.net MVC validation summary and even when the page is first loaded and when ModelState is valid it renders this out...

<div class="validation-summary-valid" data-valmsg-summary="true"><span>Errors</span>
<ul><li style="display:none"></li>
</ul></div>

The text 'Errors' is not hidden! (Its not even styled but that's not the point!)

How do I make it only show the validation summary heading when there's an error?

Cheers, Ian.

Rebut answered 8/6, 2011 at 17:33 Comment(0)
A
12

The validation-summary-valid CSS class is defined in the default MVC /Content/Site.css file as:

.validation-summary-valid
{
    display: none;
}

...do you definitely have a reference to this file in your View?

Auxochrome answered 8/6, 2011 at 18:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.