I have a Model bound by the default Model Binder.
It registers a Property as invalid based on a DataAnnotations.RequiredAttribute
Another property on the same model has a setter method that derives a valid value for that field and sets it.
However the original ModelState Error remains.
Main Question: Can I re-evaluate the ModelState?
Sub Question: Is there a better solution?
Edit
here's a simplified example of the model being bound (for the sub question)
public class Booking
{
public List<Participant> Participants {get;set;}
[Required]
public string MainEmail {get;set;}
private int _mainParticpantIndex;
[Required]
public int MainParticipantIndex
{
get { return _mainParticpantIndex; }
set
{
_mainParticpantIndex= value;
MainEmail = Particpants[value].Email
}
}
}
public class Participant
{
// not required for every participant.
public string Email {get;set;}
[Required]
public string Name {get;set;}
}