spacemonkeys
spacemonkeys

Reputation: 1749

Using ASP.NET MVC validation in ASP.NET

I am currently looking a valiadation controls in javascript and ASP.NET and have come across the new MVC "jquery.validate.unobtrusive.js" which appears to use the data tags in the HTML to do the validation, is it possible to use these in standard ASP.NET (none MVC) as my logic seems to indication you can (by adding the appropriate data tags) but I can't find any referrance to using the library outside MVC

Any does anybody know where i can get the libraries !!!

Upvotes: 2

Views: 703

Answers (3)

spacemonkeys
spacemonkeys

Reputation: 1749

Thanks people ... after a little looking about, it appears that the MVV unobtrusive controls, just dont place javascript in the page, but data- attributed to all the controls (and a second control) and then run through witha bit of jQuery, it isnt really what I was looking for, neight does it makes the page any smaller ... thanks for your answers

Upvotes: 0

Ely
Ely

Reputation: 3240

You won't be able to use the data annotations to govern your validation, but you can use jQuery Validation (which is what MVC3 is using under the covers) for client validation in a web forms app. David Ward has a few good blog posts here http://encosia.com/2009/11/04/using-jquery-validation-with-asp-net-webforms/.

Upvotes: 5

Jon
Jon

Reputation: 40062

It wont work quite the same as MVC but take a look here for the validation plugin. It shows you how to implement it and demos.

Upvotes: 1

Related Questions