Is it possible to have a model as a list in a view i.e.
@model List<SomeViewModel>
and to have a class
public class SomeViewModel
{
public int id { get; set; }
public string value { get; set; }
[OrHereCustomValidationAttribute]
public SomeProp someProp { get; set; }
}
public class SomeProp
{
[CustomValidationAttribute]
public int propID { get; set; }
[CustomValidationAttribute]
public string propValue { get; set; }
}
I need to check if the propID is equal to some value in one list item, and set the validation rule of propValue in another list item. How to do that? In any case, not sure where to put attribute, but the biggest problem is how to get an item from outside the object.