I have a strongly-typed view which has a DropDownListFor attribute on it.
Each item in the dropdown list is represented by a GUID.
What I\'m after is a way
You can validate the Guid if it contains default values - "00000000-0000-0000-0000-000000000000".
if (model.Id == Guid.Empty)
{
// TODO: handle the error or do something else
}
Bad answer. See below...
Using a regex to block empty / default Guid worked for me. Use in combination with 'Required'. I.e.
[Required]
[RegularExpression("^(?!(00000000-0000-0000-0000-000000000000)$)", ErrorMessage = "Cannot use default Guid")]
public Guid Id { get; set; }
EDIT: Actually this doesn't work. It rejects everything. I'll leave this answer so others don't bother trying it.