views:

95

answers:

1

I have just tried new version of framework (asp.net mvc 2 preview 2) that includes server and client validation with jQuery integrated, looks fine.

it has attributes for properties in my model (entity) like DataType. where i expand to see which options i have so it has all what u want u dont, like Duration and PhoneNumber :)

but i dont have simple DataType like Number!

regEx does not a good idea for it, cuz i want to user built-in option of jQuery validator for number

A: 

Range validators will enforce numbers. At least, it works that way with xVal's integration with DataAnnotations and jQuery.validate. I don't know if this works the same way in MVC 2, but it's worth a try.

[Range(0, Int32.MaxValue)]
Joel Mueller
ok, but it still looks like a little hack :(
msony