Thursday, 1 December 2011

Unobtrusive Validation in ASP.NET 4.5


The validations and the validation controls have been of supreme importance for the ASP.NET developersto assure the scalability of a program. 


In case of normal validation scenario, when as a ASP.NET programmer.. you use a simple validator to validate any control on Client-side, some JavaScript is generated and rendered as HTML. Also, some supportive JS files are also get laded by the browser for the validation.

Here, with Unobtrusive Validation, the main JavaScript is not generated and rendered to handle the Client-side validation. Instead, it uses the plain HTML data-attributes for all the validations. The HTML attributes hold all the required information of the validator and there is no inline JavaScript code generated.
Its advantage is it reduces the amount of page size with a considerable amount, because here the inline JavaScript code is not generated and this also makes the rendered HTML neat and clean.

No comments:

Post a Comment