I am facing issues with bool? ( Nullable) while rending from MVC3 view.
Model:
[MustBeTrue(ErrorMessageResourceName = "EmailConfirmationRequired", ErrorMessageResourceType = typeof(Site))]
public bool? IsEmailConfirmed { get; set; }
Views:
@Html.LabelFor(x => x.IsEmailConfirmed, string.Format(CultureInfo.CurrentCulture, "{0}", Site.EmailConfirmText))
<div class="inputClass" id="disabled">
<div>
@if (Model.IsEmailConfirmed == null)
{ Model.IsEmailConfirmed = false; }
@Html.CheckBoxFor(x => x.IsEmailConfirmed.Value)
</div>
</div>
@Html.ValidationMessageFor(x => x.IsEmailConfirmed)
After ticking the checkbox from the view,the controller is not loading its object asscociated with it. It displays "null", instead of "true" for IsEmailConfirmed. I am suspecting that the IsEmailConfirmed.Value is internally mismatched with the value IsEmailConfirmed. If not, could someone help me to resolve on this please?