asp.net.ph

BaseValidator.ErrorMessage Property

System.Web.UI.WebControls Namespace   BaseValidator Class


Sets or retrieves the text for the error message.

Syntax


Inline <asp:validator errormessage = strText ... >
Script Validator.ErrorMessage [ = strText ]

Property Value


strText String specifying the text to display when validation fails.

The property is read/write with no default value.

Remarks

Use the ErrorMessage property to specify the text to display in the validation control when validation fails. This text is also included in the ValidationSummary control, if one is placed on the Web page.

It is possible to display different text for the validation control and the ValidationSummary control. Use the Text property to specify the text to display in the validation control.

If the Text property ( inherited from the Label of the control ) contains a value, this message will overrride ErrorMessage and will be displayed at the location of the control if there is an error. However, the text specified by the ErrorMessage property always appears in the ValidationSummary control.

Example

The following example demonstrates how to use the Text and ErrorMessage properties to differentiate the error messages for a RequiredFieldValidator and a ValidationSummary control on the same page.

 Show me 

See Also

BaseValidator Members   Base Validation Control Properties   Controlling Validation Message Display Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph