IHtmlHelper.ValidationSummary(Boolean, String, Object, String) Method

Definition

Returns an unordered list (<ul> element) of validation messages that are in the ModelStateDictionary object.

C#
public Microsoft.AspNetCore.Html.IHtmlContent ValidationSummary (bool excludePropertyErrors, string message, object htmlAttributes, string tag);

Parameters

excludePropertyErrors
Boolean

If true, display model-level errors only; otherwise display all errors.

message
String

The message to display with the validation summary.

htmlAttributes
Object

An Object that contains the HTML attributes for the topmost (<div>) element. Alternatively, an IDictionary<TKey,TValue> instance containing the HTML attributes.

tag
String

The tag to wrap the message in the generated HTML. Its default value is ValidationSummaryMessageElement.

Returns

New IHtmlContent containing a <div> element wrapping the tag element and the <ul> element. An empty IHtmlContent if the current model is valid and client-side validation is disabled.

Applies to

Product Versions
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0