1
Vote

ValidationSummary works incorrectly when there are no errors in model

description

If we use
@Bootstrap.ValidationSummary()
we will get a Null Reference exception.

It caused by the following code:
public static MvcHtmlString ValidationSummary(this BootstrapHelper helper, bool excludePropertyErrors, string message, IDictionary<string, object> htmlAttributes)
        {
            var html = ValidationExtensions.ValidationSummary(helper.Html, excludePropertyErrors, message, htmlAttributes);
            html = BootstrapAlertExtensions.AlertDanger(helper, html.ToString());
            return html;
        }
because MVC HtmlHelper returns null when there are no errors in model and html.ToString() throws NRE.

comments