I need to check a checkbox by default:
I tried all of these, nothing is checking my checkbox -
@Html.CheckBoxFor(m => m.AllowRating, new { @value
I did it using Razor , works for me
Razor Code
@Html.CheckBox("CashOnDelivery", CashOnDelivery) (This is a bit or bool value) Razor don't support nullable bool
@Html.CheckBox("OnlinePayment", OnlinePayment)
C# Code
var CashOnDelivery = Convert.ToBoolean(Collection["CashOnDelivery"].Contains("true")?true:false);
var OnlinePayment = Convert.ToBoolean(Collection["OnlinePayment"].Contains("true") ? true : false);