Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

ValidationExtensions.ValidationMessage Method

Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.

  NameDescription
Public method Static member ValidationMessage(HtmlHelper, String) Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.
Public method Static member ValidationMessage(HtmlHelper, String, IDictionary<String, Object>) Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.
Public method Static member ValidationMessage(HtmlHelper, String, Object) Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.
Public method Static member ValidationMessage(HtmlHelper, String, String) Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.
Public method Static member ValidationMessage(HtmlHelper, String, String, IDictionary<String, Object>) Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.
Public method Static member ValidationMessage(HtmlHelper, String, String, Object) Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.
Top

The ValidationMessage method renders a validation message if the specified field contains incorrect incorrectinput.

If the DefaultModelBinder instance cannot bind a form-field value to the model, it adds an error to the ModelState object. When the form is rendered, the validation messages and validation summary are displayed based on the Errors property of the ModelState object.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft. All rights reserved.