HtmlHelper.ValidationSummary Method (String, Boolean, Object)

Returns an HTML div element that has the specified custom attributes defined by an attribute object, and that contains a summary message and an unordered list of validation error message from the model-state dictionary, optionally excluding field-level errors.

Namespace:  System.Web.WebPages.Html
Assembly:  System.Web.WebPages (in System.Web.WebPages.dll)


Public Function ValidationSummary ( _
    message As String, _
    excludeFieldErrors As Boolean, _
    htmlAttributes As Object _
) As IHtmlString
Dim instance As HtmlHelper 
Dim message As String 
Dim excludeFieldErrors As Boolean 
Dim htmlAttributes As Object 
Dim returnValue As IHtmlString 

returnValue = instance.ValidationSummary(message, _
    excludeFieldErrors, htmlAttributes)
public IHtmlString ValidationSummary(
    string message,
    bool excludeFieldErrors,
    Object htmlAttributes
IHtmlString^ ValidationSummary(
    String^ message, 
    bool excludeFieldErrors, 
    Object^ htmlAttributes
member ValidationSummary : 
        message:string * 
        excludeFieldErrors:bool * 
        htmlAttributes:Object -> IHtmlString
public function ValidationSummary(
    message : String, 
    excludeFieldErrors : boolean, 
    htmlAttributes : Object
) : IHtmlString


  • message
    Type: System.String
    The summary message that comes before the list of validation error messages.
  • excludeFieldErrors
    Type: System.Boolean
    true to exclude field-level validation error messages from the results; false to include and field-level validation error messages.
  • htmlAttributes
    Type: System.Object
    An object that contains custom attributes for the element. The attribute names and values are retrieved through reflection by examining the properties of the object.

Return Value

Type: System.Web.IHtmlString
The HTML markup that represents the validation error messages.


This method is used in conjunction with the System.Web.Helpers.Validation class.

The returned markup consists of an HTML div element in the following form:

<div ...htmlAttributes...>
    <li>summary message</li>
    <li>summary message</li>

Each summary message contains a validation error message that is associated with an error in the model state. If excludeFieldErrors is true, field-level errors are excluded from the list; otherwise, both model-level and field-level errors are included.

See Also


HtmlHelper Class

ValidationSummary Overload

System.Web.WebPages.Html Namespace