tags:

views:

18

answers:

0

I have Composite model. I am building radioset using MVCContrib

<%= this.ValidationMessage(x => x.Building.Type)%> <%= this.RadioSet(x => x.Building.Type).Options(Model.Types).ItemFormat("{0}
")%>

Class Building (property of the model) contains Int property Type.

[Required(ErrorMessage = "Please choose Type")] public int Type { get; set; }

but if on the form nothing selected object Building will be null and validation do not fired. In that case validation fired only if something selected because in such case object Building is not empty. I think may be i should some how assign some default value for Building.Type on the view and then i may use Range validation to say if default value - nothing selected.

Any ideas how may i do that or is there some another way of doing this?