O'Reilly logo

Applied ASP.NET 4 in Context by Adam Freeman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Styling and Positioning Validation Messages

By default, the HTML that is produced by the validation controls is pretty basic, as shown in Listing 17-8.

Listing 17-8. The HTML generated by a validation control

<span id="RequiredFieldValidator1" style="display: none;">Enter a number of laps</span>

The error messages are expressed as span elements, and they are hidden from the user initially. If validation changes, then the JavaScript that the validation control adds to the page shows the span element to the user, revealing the error message. You can style the error messages that you display to the user either by setting a value for the CssClass property or by setting individual style properties in the property sheet. For all of the examples so ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required