How to Use Unobtrusive Validation in ASP.NET

ASP.NET Web Forms already has validation controls ever since its first release. In the earlier releases, these validation controls used JavaScript that is emitted by ASP.NET Web Framework. The unobtrusive validation, however, will make use of the data-* attribute of HTML5 for validation.

 

Unobtrusive validation emits data-* attributes of HTML5 that contain the validation information. There is no JavaScript generated which means it reduces your page size. Additionally unobtrusive validation relies on JQuery library rather than a proprietary script.

Unobtrusive validation is enabled by default when you  create a new Web Forms project. If you open web.config in your newly create Web Forms project, you’ll see this markup: <appSettings>.

 

Read the rest of the tutorial here: http://www.codeguru.com/csharp/.net/net_asp/using-unobstructive-validation-in-asp.net-4.5-web-forms.htm

Leave a Reply

Your email address will not be published. Required fields are marked *