ValidationExtensions.ValidationSummary Method (HtmlHelper, String, IDictionary(Of String, Object))
Returns an unordered list (ul element) of validation messages that are in the ModelStateDictionary object.
Namespace: System.Web.Mvc.Html
Assembly: System.Web.Mvc (in System.Web.Mvc.dll)
'Declaration <ExtensionAttribute> _ Public Shared Function ValidationSummary ( _ htmlHelper As HtmlHelper, _ message As String, _ htmlAttributes As IDictionary(Of String, Object) _ ) As MvcHtmlString 'Usage Dim htmlHelper As HtmlHelper Dim message As String Dim htmlAttributes As IDictionary(Of String, Object) Dim returnValue As MvcHtmlString returnValue = htmlHelper.ValidationSummary(message, _ htmlAttributes)
Parameters
- htmlHelper
- Type: System.Web.Mvc.HtmlHelper
The HTML helper instance that this method extends.
- message
- Type: System.String
The message to display if the specified field contains an error.
- htmlAttributes
- Type: System.Collections.Generic.IDictionary(Of String, Object)
A dictionary that contains the HTML attributes for the element.
Return Value
Type: System.Web.Mvc.MvcHtmlStringA string that contains an unordered list (ul element) of validation messages.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type HtmlHelper. When you use instance method syntax to call this method, omit the first parameter. For more information, see https://msdn.microsoft.com/en-us/library/bb384936(v=vs.108) or https://msdn.microsoft.com/en-us/library/bb383977(v=vs.108).The ValidationSummary method displays a list of all validation messages on the page.
If the DefaultModelBinder instance cannot bind a form-field value to the model, the binder adds an error to the ModelState object. When the view is rendered, the validation messages and validation summary are displayed based on the Errors property of the ModelState object.
Show: