Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Client-side validation with a model-less view in ASP.NET MVC 2

I'd like to use the new client side validation features in MVC 2 but I have a particular view that just has a couple textboxes on it and I don't want to create a strongly typed model for it. Can someone describe how to leverage the validation goodness in MVC 2 w/o a strongly typed model?

like image 366
James Alexander Avatar asked Dec 06 '25 04:12

James Alexander


1 Answers

I don’t think it can be done as client side validation uses Data Annotations in the System.ComponentModel.DataAnnotations namespace. To my knowledge you have to bind this to an object. I would suggest looking at a jquery solution.

like image 109
Zaffiro Avatar answered Dec 09 '25 16:12

Zaffiro



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!