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)
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.
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Note