开发者

ASP.net MVC ValidationSummary always being rendered

开发者 https://www.devze.com 2023-03-11 18:22 出处:网络
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...

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-val开发者_StackOverflow中文版id" 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.


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消