System.Web.UI.WebControls Namespace BaseValidator Class
Sets or retrieves the display behavior of the error message in a validation control.
Inline |
<asp:validator display = strDisplay ... > |
Script |
Validator.Display [ = strDisplay ] |
The property is read/write with a default value of Static.
Use the Display property to specify the display behavior of the error message in the validation control. The following table briefly describes the different values that can be used.
Display Behavior |
Description |
Dynamic |
Space for the validation message is dynamically added to the page if validation fails. |
None |
The validation message is never displayed inline. |
Static |
Space for the validation message is allocated in the page layout. |
The display behavior depends on whether client-side validation is performed. If client-side validation is not active ( because the browser does not support it or because it has been disabled ), Static and Dynamic behave the same way: the error message only takes up space if it is displayed. The ability to dynamically allocate space for the message when it is not being displayed ( Static ) only works with client-side validation.
The following example demonstrates how to use the Display property to programatically set the validation message display mode when validation fails.
Show me
BaseValidator Members Base Validation Control Properties Controlling Validation Message Display