This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!
Controlling Validation Error Message Display
You can display error message text:
- In-line (only) Next to the control (in place where the validation control is located).
- Summary (only) In a separate summary of all errors. Optionally, the errors can appear in a pop-up message. (The option to use a pop-up message is available only if the user is using a DHTML-compatible browser.)
- In-line and summarized In that case, the error message can be different in the summary and in place. You can use this option to show a shorter error message in place (with more detail in the summary) or to show an error glyph next to the input field and an error message in the summary.
- Custom You can create your own error message display. For details, see Displaying Custom Error Messages.
You also have options for specifying the format and layout of error messages. For details, see Formatting Validation Error Messages.
If you want to display summarized or pop-up error messages, you need to add a control to the page.
To add summarized error messages
- Add a ValidationSummary control to the page at the location where you want to display the collected error messages.
- Set the summary control's DisplayMode property to format the error messages, using one of the following values defined in the ValidationSummaryDisplayMode enumeration:
- BulletList Each message appears in a bullet list. (This is the default.)
- List Each messages appears on its own line.
- SingleParagraph Each message appears as a sentence in a paragraph.
- Optionally set the control's HeaderText property to provide a title or header for the error messages.
Choosing inline and summary display involves setting different combinations of properties in the individual validation controls.
To choose in-line and summary error display
- If you want to display summary errors, add a ValidationSummary control as described in the procedure above.
- Set the ErrorMessage, Text, and ValidatorDisplay properties of the individual validation controls according to the following table:
Option |
ValidationSummary control required? |
Property settings on validation control |
Inline only |
no |
ValidatorDisplay = VisibleStaticLayout or
VisibleDynamicLayout
ErrorMessage = (error text)
|
Summary only (including optional pop-up ) |
yes |
ValidatorDisplay = NeverVisible
ErrorMessage = (error text)
|
Inline and summary (including optional pop-up) |
yes |
ValidatorDisplay = VisibleStaticLayout or
VisibleDynamicLayout
ErrorMessage = (error text for summary)
Text = (in-line error text)
|
If the user is working with a DHTML-compatible browser such as Internet Explorer 4.0 or later, summarized error messages can also appear in a pop-up window.
To display summarized error messages in a pop-up window
See Also
- Validation Controls | Introduction to Validating User Input in Web Forms |