0

I want to implement client validation on a list of objects. I want to make sure that the list has at least one object, so I used custom validation as described here and made it client validable. This works well when the list is of simple datatype like an int. That is

public List<int> var{get; set;} 

With this I can include a Listboxfor in my view and when the form containing the list is submitted, client validation kicks in. However I now have a list of objects

public List<MyClass> var{get; set;}

Items are added to this list dynamically. I can therefore not have a ListBoxFor in my View. How can i display the list in my View so that that client validation picks it up?

Community
  • 1
  • 1
jpo
  • 3,959
  • 20
  • 59
  • 102

0 Answers0