I'm using a checkbox to handle allow Ordering function, which generates HTML code below:
@using (Html.BeginForm("EditFarm", "CustomerManagement", FormMethod.Post))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
@Html.HiddenFor(model => model.AllowOrder)
<div>
<label for="allowOrder">Allow Ordering</label>
<br />
<input type="checkbox" id="allowOrder" name="AllowOrder" value="true" @(Model.AllowOrder ? "checked" : "") />
</div>
....
}
The problem is checkbox AllowerOrder always pass true value to Controller even when it's unchecked
This is code in Controller:
public ActionResult EditFarm([Bind(Include = "Id, ERPCustomerCode, ERPId, CategoryId, Size, Large, OtherId, AllowOrder")] NewFarm farm)
{
...
}
Tried the debug, received model always have AllowerOrder = true.

Is there any issue in my code? Any help would be appreciated! Thanks!
AllowOrder. This one is more likely bound to it:@Html.HiddenFor(model => model.AllowOrder)@Html.CheckboxFor. Check here@Html.HiddenFor(model => model.AllowOrder)overrides the checkbox value because it generates<input type="hidden" name="AllowOrder" />. Note that both elements have samenameattribute.@Html.CheckBoxFor, what thing doesn't work? Is that related tocheckedattribute? I think just puttingnameattribute withinputelement is not enough to bind checkbox value for viewmodel property.<input type="checkbox" id="allowOrder" name="AllowOrder" value="true" @(Model.AllowOrder ? "checked" : "") />