Search code examples
asp.net-mvc-2asp.net-mvc-2-validation

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?


Solution

  • 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.