BaseValidator.ErrorMessage Property
Assembly: System.Web (in system.web.dll)
[LocalizableAttribute(true)] public: virtual property String^ ErrorMessage { String^ get () sealed; void set (String^ value) sealed; }
/** @property */ public final String get_ErrorMessage () /** @property */ public final void set_ErrorMessage (String value)
public final function get ErrorMessage () : String public final function set ErrorMessage (value : String)
Not applicable.
Property Value
The error message displayed in a ValidationSummary control when validation fails. The default value is an empty string (""), which indicates that this property is not set.When using a ValidationSummary control, use the ErrorMessage property to specify the text to display in the ValidationSummary control when validation fails for the current validation control. To specify the text to display in the validation control itself, use the Text property.
Note: |
|---|
| If you set the ErrorMessage property without setting the Text property, the value of the ErrorMessage property is also displayed in the validation control. |
The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see LocalizableAttribute and ASP.NET Globalization and Localization.
The following code example demonstrates how to use the ErrorMessage property to specify different messages for the ValidationSummary control and the RequiredFieldValidator and CompareValidator controls.
Security Note: |
|---|
| This example has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview (Visual Studio). |
Note: