Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

HtmlHelper.ValidationSummary Method (String, IDictionary<String, Object>)

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

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

public IHtmlString ValidationSummary(
	string message,
	IDictionary<string, Object> htmlAttributes
)

Parameters

message
Type: System.String
The message that comes before the list of validation error messages.
htmlAttributes
Type: System.Collections.Generic.IDictionary<String, Object>
The names and values of custom attributes for the element.

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...>
  <span>message</span>
  <ul>
    <li>summary message</li>
    <li>summary message</li>
    ...
  <ul>
</div>

Each summary message contains a validation error message that is associated with a model-level and field-level error in the model-state dictionary.

Show:
© 2015 Microsoft