Asp.Net Mvc Checkboxfor default?
model
[DefaultValue(true)]
public bool IsActive { get; set; }
View
@Html.CheckBoxFor(model => model.IsActive)
html output and this is my expected
<input data-val="true" data-val-required="Yayında alanı boş bırakılmamalıdır!" id="IsActive" name="IsActive" type="checkbox" value="true" class="valid">
but the checkbox is not checked. I can't figure out why? What am I missing?
Thank.
+3
source to share