Javascript 复选框值始终保存为真,即使在mvc中未选中复选框

Javascript 复选框值始终保存为真,即使在mvc中未选中复选框,javascript,c#,json,model-view-controller,Javascript,C#,Json,Model View Controller,当我添加new if复选框时,如果未选中save按钮,则按value save in database true, 当我按下编辑按钮时,若值被选中,那个么复选框将不显示。 所以,当复选框选中时,我想要在数据库中保存true,若复选框未选中,则保存false。 当我按edit时,如果复选框值为true,则显示复选框值已选中,如果不为true,则显示未选中。 问题单选按钮也是如此 <div class="modal-content" style="width:140%"

当我添加new if复选框时,如果未选中save按钮,则按value save in database true, 当我按下编辑按钮时,若值被选中,那个么复选框将不显示。 所以,当复选框选中时,我想要在数据库中保存true,若复选框未选中,则保存false。 当我按edit时,如果复选框值为true,则显示复选框值已选中,如果不为true,则显示未选中。 问题单选按钮也是如此

            <div class="modal-content" style="width:140%">
                <!--Header-->
                <div class="modal-header">
                    <p class="heading lead">Update Purchase Order</p>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true" class="white-text">&times;</span>
                    </button>
                </div>
                <!--Body-->
                <form id="NewOrder">
                    <div class="modal-body">
                        <div class="form-row">
                            <div class="col" id="poidd">
                                <!-- Purchase PO ID -->
                                <div class="md-form">
                                    @Html.TextBoxFor(m=>m.PO_ID, new { @class = "form-control mr-sm-3", @id = "POUID", Required = true })
                                </div>
                            </div>
                            <div class="col">
                                <!-- Purchase PO NO -->
                                <label for="lblPONo" style="font-weight:bold; ">PO No.</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m=>m.PONo, new { @class = "form-control mr-sm-3", @id = "POUNO", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- PO Date -->
                                <label for="lblPODatepicker" style="font-weight:bold; "> PO Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.PODate, new { @class = "form-control", @id = "POUDate", Required = true, @Readonly=true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- Requisition Date -->
                                <label for="lblRequisitionDatepicker" style="font-weight:bold; "> Requisition Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.RequisitionDate, new { @class = "form-control", @id = "RequisitionUDate", Required = true, @Readonly = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- Delivery Date -->
                                <label for="lblDeliveryDatepicker" style="font-weight:bold; "> Delivery Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.DeliveryDate, new { @class = "form-control", @id = "DeliveryUDate", Required = true, @Readonly = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;


                            <div class="col">
                                <!-- IsCancel-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsCancelled, new { @class = "custom-control-input", @id = "IsUCancelled" })

                                    <label class="custom-control-label" for="IsUCancelled">Cancel</label>
                                </div>

                                <!-- IsClosed-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsClosed, new { @class = "custom-control-input", @id = "IsUClosed" })

                                    <label class="custom-control-label" for="IsUClosed">Closed</label>
                                </div>

                                <!-- IsPending-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsPending, new { @class = "custom-control-input", @id = "IsUPending" })

                                    <label class="custom-control-label" for="IsUPending">Pending</label>
                                </div>

                            </div>



                        </div>

                        <div class="form-row">
                            <div class="col">
                                <!-- Party Code -->
                                <div class="md-form">
                                    @Html.DropDownListFor(m => m.PartyCode, ViewBag.PartyCode as List<SelectListItem>, new { @class = "chosen-select", id = "PartyUCode", Required = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;
                            <div class="col" style="margin-left:1.5%;">
                                <!-- SellerQuotRefNo -->
                                <label for="lblSellerQuotRefNo" style="font-weight:bold; ">Seller Quot Ref No.</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.SellerQuotRefNo, new { @class = "form-control", @id = "SellerUQuotRefNo", @placeholder = "SellerQuotRefNo", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.5%;">
                                <!--SellerQuotDate -->
                                <label for="lblSellerQuotDateDatepicker" style="font-weight:bold; "> Seller Quot Date</label>
                                <div class="md-form">

                                    @Html.TextBoxFor(m => m.SellerQuotDate, new { @class = "form-control", @id = "SellerUQuotDate", Required = true, @Readonly = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.8%;">
                                <!-- ComparativeRefNo -->
                                <label for="lblComparativeRefNo" style="font-weight:bold; "> Comparative RefNo</label>
                                <div class="md-form">

                                    @Html.TextBoxFor(m => m.ComparativeRefNo, new { @class = "form-control", @id = "ComparativeURefNo", @placeholder = "ComparativeRefNo", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">

                                <fieldset>
                                    @Html.RadioButtonFor(e => e.WithItemCode, true, new { id = "RUtrue", @checked = true })
                                    @Html.Label("RUtrue", "With Item Code")<br />

                                    @Html.RadioButtonFor(e => e.WithItemCode, false, new { id = "RUfalse" })
                                    @Html.Label("RUfalse", "With GL Code")
                                </fieldset>

                                <!-- IsPending-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.ValidateQty, new { @class = "custom-control-input", @id = "ValidateUQty" })

                                    <label class="custom-control-label" for="ValidateQty">Validate Qty</label>
                                </div>

                            </div>

                        </div>

                        <div class="form-row">

                            <div class="col" style="margin-left:1.5%;">
                                <!--TermsOfDelivery -->
                                <label for="lblTermsOfDelivery" style="font-weight:bold; "> Terms Of Delivery</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfDelivery, new { @class = "form-control", @id = "UTermsOfDelivery", @placeholder = "TermsOfDelivery", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.8%;">
                                <!--TermsOfPayment -->

                                <label for="lblTermsOfPayment" style="font-weight:bold; "> Terms Of Payment</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfPayment, new { @class = "form-control", @id = "UTermsOfPayment", @placeholder = "TermsOfPayment", Required = true })

                                </div>
                            </div>

                            <div class="col" style="margin-left:1.8%;">
                                <!-- TermsOfConditions -->
                                <label for="lblTermsOfConditions" style="font-weight:bold; ">Terms Of Conditions</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfConditions, new { @class = "form-control", @id = "UTermsOfConditions", @placeholder = "TermsOfConditions", Required = true })


                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="reset" class="btn btn-primary" data-dismiss="modal">Close</button>
                            <button id="UpdatePO" type="submit" class="btn btn-primary">Update</button>
                        </div>
                    </div>
                </form>



            </div>

            <!--/.Content-->
        </div>
    </div>
HTML

            <div class="modal-content" style="width:140%">
                <!--Header-->
                <div class="modal-header">
                    <p class="heading lead">Update Purchase Order</p>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true" class="white-text">&times;</span>
                    </button>
                </div>
                <!--Body-->
                <form id="NewOrder">
                    <div class="modal-body">
                        <div class="form-row">
                            <div class="col" id="poidd">
                                <!-- Purchase PO ID -->
                                <div class="md-form">
                                    @Html.TextBoxFor(m=>m.PO_ID, new { @class = "form-control mr-sm-3", @id = "POUID", Required = true })
                                </div>
                            </div>
                            <div class="col">
                                <!-- Purchase PO NO -->
                                <label for="lblPONo" style="font-weight:bold; ">PO No.</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m=>m.PONo, new { @class = "form-control mr-sm-3", @id = "POUNO", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- PO Date -->
                                <label for="lblPODatepicker" style="font-weight:bold; "> PO Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.PODate, new { @class = "form-control", @id = "POUDate", Required = true, @Readonly=true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- Requisition Date -->
                                <label for="lblRequisitionDatepicker" style="font-weight:bold; "> Requisition Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.RequisitionDate, new { @class = "form-control", @id = "RequisitionUDate", Required = true, @Readonly = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- Delivery Date -->
                                <label for="lblDeliveryDatepicker" style="font-weight:bold; "> Delivery Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.DeliveryDate, new { @class = "form-control", @id = "DeliveryUDate", Required = true, @Readonly = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;


                            <div class="col">
                                <!-- IsCancel-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsCancelled, new { @class = "custom-control-input", @id = "IsUCancelled" })

                                    <label class="custom-control-label" for="IsUCancelled">Cancel</label>
                                </div>

                                <!-- IsClosed-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsClosed, new { @class = "custom-control-input", @id = "IsUClosed" })

                                    <label class="custom-control-label" for="IsUClosed">Closed</label>
                                </div>

                                <!-- IsPending-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsPending, new { @class = "custom-control-input", @id = "IsUPending" })

                                    <label class="custom-control-label" for="IsUPending">Pending</label>
                                </div>

                            </div>



                        </div>

                        <div class="form-row">
                            <div class="col">
                                <!-- Party Code -->
                                <div class="md-form">
                                    @Html.DropDownListFor(m => m.PartyCode, ViewBag.PartyCode as List<SelectListItem>, new { @class = "chosen-select", id = "PartyUCode", Required = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;
                            <div class="col" style="margin-left:1.5%;">
                                <!-- SellerQuotRefNo -->
                                <label for="lblSellerQuotRefNo" style="font-weight:bold; ">Seller Quot Ref No.</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.SellerQuotRefNo, new { @class = "form-control", @id = "SellerUQuotRefNo", @placeholder = "SellerQuotRefNo", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.5%;">
                                <!--SellerQuotDate -->
                                <label for="lblSellerQuotDateDatepicker" style="font-weight:bold; "> Seller Quot Date</label>
                                <div class="md-form">

                                    @Html.TextBoxFor(m => m.SellerQuotDate, new { @class = "form-control", @id = "SellerUQuotDate", Required = true, @Readonly = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.8%;">
                                <!-- ComparativeRefNo -->
                                <label for="lblComparativeRefNo" style="font-weight:bold; "> Comparative RefNo</label>
                                <div class="md-form">

                                    @Html.TextBoxFor(m => m.ComparativeRefNo, new { @class = "form-control", @id = "ComparativeURefNo", @placeholder = "ComparativeRefNo", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">

                                <fieldset>
                                    @Html.RadioButtonFor(e => e.WithItemCode, true, new { id = "RUtrue", @checked = true })
                                    @Html.Label("RUtrue", "With Item Code")<br />

                                    @Html.RadioButtonFor(e => e.WithItemCode, false, new { id = "RUfalse" })
                                    @Html.Label("RUfalse", "With GL Code")
                                </fieldset>

                                <!-- IsPending-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.ValidateQty, new { @class = "custom-control-input", @id = "ValidateUQty" })

                                    <label class="custom-control-label" for="ValidateQty">Validate Qty</label>
                                </div>

                            </div>

                        </div>

                        <div class="form-row">

                            <div class="col" style="margin-left:1.5%;">
                                <!--TermsOfDelivery -->
                                <label for="lblTermsOfDelivery" style="font-weight:bold; "> Terms Of Delivery</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfDelivery, new { @class = "form-control", @id = "UTermsOfDelivery", @placeholder = "TermsOfDelivery", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.8%;">
                                <!--TermsOfPayment -->

                                <label for="lblTermsOfPayment" style="font-weight:bold; "> Terms Of Payment</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfPayment, new { @class = "form-control", @id = "UTermsOfPayment", @placeholder = "TermsOfPayment", Required = true })

                                </div>
                            </div>

                            <div class="col" style="margin-left:1.8%;">
                                <!-- TermsOfConditions -->
                                <label for="lblTermsOfConditions" style="font-weight:bold; ">Terms Of Conditions</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfConditions, new { @class = "form-control", @id = "UTermsOfConditions", @placeholder = "TermsOfConditions", Required = true })


                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="reset" class="btn btn-primary" data-dismiss="modal">Close</button>
                            <button id="UpdatePO" type="submit" class="btn btn-primary">Update</button>
                        </div>
                    </div>
                </form>



            </div>

            <!--/.Content-->
        </div>
    </div>

            <div class="modal-content" style="width:140%">
                <!--Header-->
                <div class="modal-header">
                    <p class="heading lead">Update Purchase Order</p>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true" class="white-text">&times;</span>
                    </button>
                </div>
                <!--Body-->
                <form id="NewOrder">
                    <div class="modal-body">
                        <div class="form-row">
                            <div class="col" id="poidd">
                                <!-- Purchase PO ID -->
                                <div class="md-form">
                                    @Html.TextBoxFor(m=>m.PO_ID, new { @class = "form-control mr-sm-3", @id = "POUID", Required = true })
                                </div>
                            </div>
                            <div class="col">
                                <!-- Purchase PO NO -->
                                <label for="lblPONo" style="font-weight:bold; ">PO No.</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m=>m.PONo, new { @class = "form-control mr-sm-3", @id = "POUNO", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- PO Date -->
                                <label for="lblPODatepicker" style="font-weight:bold; "> PO Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.PODate, new { @class = "form-control", @id = "POUDate", Required = true, @Readonly=true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- Requisition Date -->
                                <label for="lblRequisitionDatepicker" style="font-weight:bold; "> Requisition Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.RequisitionDate, new { @class = "form-control", @id = "RequisitionUDate", Required = true, @Readonly = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- Delivery Date -->
                                <label for="lblDeliveryDatepicker" style="font-weight:bold; "> Delivery Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.DeliveryDate, new { @class = "form-control", @id = "DeliveryUDate", Required = true, @Readonly = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;


                            <div class="col">
                                <!-- IsCancel-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsCancelled, new { @class = "custom-control-input", @id = "IsUCancelled" })

                                    <label class="custom-control-label" for="IsUCancelled">Cancel</label>
                                </div>

                                <!-- IsClosed-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsClosed, new { @class = "custom-control-input", @id = "IsUClosed" })

                                    <label class="custom-control-label" for="IsUClosed">Closed</label>
                                </div>

                                <!-- IsPending-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsPending, new { @class = "custom-control-input", @id = "IsUPending" })

                                    <label class="custom-control-label" for="IsUPending">Pending</label>
                                </div>

                            </div>



                        </div>

                        <div class="form-row">
                            <div class="col">
                                <!-- Party Code -->
                                <div class="md-form">
                                    @Html.DropDownListFor(m => m.PartyCode, ViewBag.PartyCode as List<SelectListItem>, new { @class = "chosen-select", id = "PartyUCode", Required = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;
                            <div class="col" style="margin-left:1.5%;">
                                <!-- SellerQuotRefNo -->
                                <label for="lblSellerQuotRefNo" style="font-weight:bold; ">Seller Quot Ref No.</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.SellerQuotRefNo, new { @class = "form-control", @id = "SellerUQuotRefNo", @placeholder = "SellerQuotRefNo", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.5%;">
                                <!--SellerQuotDate -->
                                <label for="lblSellerQuotDateDatepicker" style="font-weight:bold; "> Seller Quot Date</label>
                                <div class="md-form">

                                    @Html.TextBoxFor(m => m.SellerQuotDate, new { @class = "form-control", @id = "SellerUQuotDate", Required = true, @Readonly = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.8%;">
                                <!-- ComparativeRefNo -->
                                <label for="lblComparativeRefNo" style="font-weight:bold; "> Comparative RefNo</label>
                                <div class="md-form">

                                    @Html.TextBoxFor(m => m.ComparativeRefNo, new { @class = "form-control", @id = "ComparativeURefNo", @placeholder = "ComparativeRefNo", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">

                                <fieldset>
                                    @Html.RadioButtonFor(e => e.WithItemCode, true, new { id = "RUtrue", @checked = true })
                                    @Html.Label("RUtrue", "With Item Code")<br />

                                    @Html.RadioButtonFor(e => e.WithItemCode, false, new { id = "RUfalse" })
                                    @Html.Label("RUfalse", "With GL Code")
                                </fieldset>

                                <!-- IsPending-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.ValidateQty, new { @class = "custom-control-input", @id = "ValidateUQty" })

                                    <label class="custom-control-label" for="ValidateQty">Validate Qty</label>
                                </div>

                            </div>

                        </div>

                        <div class="form-row">

                            <div class="col" style="margin-left:1.5%;">
                                <!--TermsOfDelivery -->
                                <label for="lblTermsOfDelivery" style="font-weight:bold; "> Terms Of Delivery</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfDelivery, new { @class = "form-control", @id = "UTermsOfDelivery", @placeholder = "TermsOfDelivery", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.8%;">
                                <!--TermsOfPayment -->

                                <label for="lblTermsOfPayment" style="font-weight:bold; "> Terms Of Payment</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfPayment, new { @class = "form-control", @id = "UTermsOfPayment", @placeholder = "TermsOfPayment", Required = true })

                                </div>
                            </div>

                            <div class="col" style="margin-left:1.8%;">
                                <!-- TermsOfConditions -->
                                <label for="lblTermsOfConditions" style="font-weight:bold; ">Terms Of Conditions</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfConditions, new { @class = "form-control", @id = "UTermsOfConditions", @placeholder = "TermsOfConditions", Required = true })


                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="reset" class="btn btn-primary" data-dismiss="modal">Close</button>
                            <button id="UpdatePO" type="submit" class="btn btn-primary">Update</button>
                        </div>
                    </div>
                </form>



            </div>

            <!--/.Content-->
        </div>
    </div>
Jqgrid

            <div class="modal-content" style="width:140%">
                <!--Header-->
                <div class="modal-header">
                    <p class="heading lead">Update Purchase Order</p>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true" class="white-text">&times;</span>
                    </button>
                </div>
                <!--Body-->
                <form id="NewOrder">
                    <div class="modal-body">
                        <div class="form-row">
                            <div class="col" id="poidd">
                                <!-- Purchase PO ID -->
                                <div class="md-form">
                                    @Html.TextBoxFor(m=>m.PO_ID, new { @class = "form-control mr-sm-3", @id = "POUID", Required = true })
                                </div>
                            </div>
                            <div class="col">
                                <!-- Purchase PO NO -->
                                <label for="lblPONo" style="font-weight:bold; ">PO No.</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m=>m.PONo, new { @class = "form-control mr-sm-3", @id = "POUNO", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- PO Date -->
                                <label for="lblPODatepicker" style="font-weight:bold; "> PO Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.PODate, new { @class = "form-control", @id = "POUDate", Required = true, @Readonly=true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- Requisition Date -->
                                <label for="lblRequisitionDatepicker" style="font-weight:bold; "> Requisition Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.RequisitionDate, new { @class = "form-control", @id = "RequisitionUDate", Required = true, @Readonly = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- Delivery Date -->
                                <label for="lblDeliveryDatepicker" style="font-weight:bold; "> Delivery Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.DeliveryDate, new { @class = "form-control", @id = "DeliveryUDate", Required = true, @Readonly = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;


                            <div class="col">
                                <!-- IsCancel-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsCancelled, new { @class = "custom-control-input", @id = "IsUCancelled" })

                                    <label class="custom-control-label" for="IsUCancelled">Cancel</label>
                                </div>

                                <!-- IsClosed-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsClosed, new { @class = "custom-control-input", @id = "IsUClosed" })

                                    <label class="custom-control-label" for="IsUClosed">Closed</label>
                                </div>

                                <!-- IsPending-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsPending, new { @class = "custom-control-input", @id = "IsUPending" })

                                    <label class="custom-control-label" for="IsUPending">Pending</label>
                                </div>

                            </div>



                        </div>

                        <div class="form-row">
                            <div class="col">
                                <!-- Party Code -->
                                <div class="md-form">
                                    @Html.DropDownListFor(m => m.PartyCode, ViewBag.PartyCode as List<SelectListItem>, new { @class = "chosen-select", id = "PartyUCode", Required = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;
                            <div class="col" style="margin-left:1.5%;">
                                <!-- SellerQuotRefNo -->
                                <label for="lblSellerQuotRefNo" style="font-weight:bold; ">Seller Quot Ref No.</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.SellerQuotRefNo, new { @class = "form-control", @id = "SellerUQuotRefNo", @placeholder = "SellerQuotRefNo", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.5%;">
                                <!--SellerQuotDate -->
                                <label for="lblSellerQuotDateDatepicker" style="font-weight:bold; "> Seller Quot Date</label>
                                <div class="md-form">

                                    @Html.TextBoxFor(m => m.SellerQuotDate, new { @class = "form-control", @id = "SellerUQuotDate", Required = true, @Readonly = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.8%;">
                                <!-- ComparativeRefNo -->
                                <label for="lblComparativeRefNo" style="font-weight:bold; "> Comparative RefNo</label>
                                <div class="md-form">

                                    @Html.TextBoxFor(m => m.ComparativeRefNo, new { @class = "form-control", @id = "ComparativeURefNo", @placeholder = "ComparativeRefNo", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">

                                <fieldset>
                                    @Html.RadioButtonFor(e => e.WithItemCode, true, new { id = "RUtrue", @checked = true })
                                    @Html.Label("RUtrue", "With Item Code")<br />

                                    @Html.RadioButtonFor(e => e.WithItemCode, false, new { id = "RUfalse" })
                                    @Html.Label("RUfalse", "With GL Code")
                                </fieldset>

                                <!-- IsPending-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.ValidateQty, new { @class = "custom-control-input", @id = "ValidateUQty" })

                                    <label class="custom-control-label" for="ValidateQty">Validate Qty</label>
                                </div>

                            </div>

                        </div>

                        <div class="form-row">

                            <div class="col" style="margin-left:1.5%;">
                                <!--TermsOfDelivery -->
                                <label for="lblTermsOfDelivery" style="font-weight:bold; "> Terms Of Delivery</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfDelivery, new { @class = "form-control", @id = "UTermsOfDelivery", @placeholder = "TermsOfDelivery", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.8%;">
                                <!--TermsOfPayment -->

                                <label for="lblTermsOfPayment" style="font-weight:bold; "> Terms Of Payment</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfPayment, new { @class = "form-control", @id = "UTermsOfPayment", @placeholder = "TermsOfPayment", Required = true })

                                </div>
                            </div>

                            <div class="col" style="margin-left:1.8%;">
                                <!-- TermsOfConditions -->
                                <label for="lblTermsOfConditions" style="font-weight:bold; ">Terms Of Conditions</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfConditions, new { @class = "form-control", @id = "UTermsOfConditions", @placeholder = "TermsOfConditions", Required = true })


                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="reset" class="btn btn-primary" data-dismiss="modal">Close</button>
                            <button id="UpdatePO" type="submit" class="btn btn-primary">Update</button>
                        </div>
                    </div>
                </form>



            </div>

            <!--/.Content-->
        </div>
    </div>
<script type="text/javascript">


        jQuery(document).ready(function ($) {

            // master grid
            var $grid = $("#jqGrid");
            $grid.jqGrid({
                url: '@Url.Action("POGrid")',
                datatype: "json",
                jsonReader: { id: 'PO_ID' },

                colModel: [
                    { name: 'PO_ID', index: 'PO_ID', label: 'PO ID', hidden: true, editable: true, editable: "disabled", align: "center", width: 12 },
                    { name: 'Comp_ID', index: 'Comp_ID', label: 'Comp ID', hidden: true, editable: true, searchoptions: { sopt: ['cn'] }, align: "left", width: 2 },
                    { name: 'GL_Year', index: 'GL_Year', label: 'GL Year', hidden: true, editable: true, searchoptions: { sopt: ['cn'] }, align: "left",  width: 40 },
                    {
                        name: 'PODate', index: 'PODate', label: 'PO Date', width: 100,
                        editable: true, edittype: 'text',
                        editoptions: {
                            size: 10, maxlengh: 10,

                            dataInit: function (element) {
                                $(element).datepicker({ dateFormat: 'yy/mm/dd' })
                            }
                        }
                    },
                    { name: 'PartyName', index: 'PartyName', label: 'Party', width: 200, editable: true },

                    { name: 'SellerQuotRefNo', index: 'SellerQuotRefNo', label: 'S Q RefNo', width: 100, editable: true },
                    {
                        name: 'SellerQuotDate', index: 'SellerQuotDate', label: 'S Q Date', width: 100,
                        editable: true, edittype: 'text',
                        editoptions: {
                            size: 10, maxlengh: 10,

                            dataInit: function (element) {
                                $(element).datepicker({ dateFormat: 'yy/mm/dd' })
                            }
                        }
                    },
                    {
                        name: 'RequisitionDate', index: 'RequisitionDate', label: 'R Date', width: 100,
                        editable: true, edittype: 'text',
                        editoptions: {
                            size: 10, maxlengh: 10,

                            dataInit: function (element) {
                                $(element).datepicker({ dateFormat: 'yy/mm/dd' })
                            }
                        }
                    },
                    {
                        name: 'DeliveryDate', index: 'DeliveryDate', label: 'D Date', width: 100,
                        editable: true, edittype: 'text',
                        editoptions: {
                            size: 10, maxlengh: 10,

                            dataInit: function (element) {
                                $(element).datepicker({ dateFormat: 'yy/mm/dd' })
                            }
                        }
                    },
                    { name: 'ComparativeRefNo', index: 'ComparativeRefNo', label: 'C RefNo', width: 100, editable: true },
                    { name: 'TermsOfConditions', index: 'TermsOfConditions', label: 'Terms Conditions', hidden:true, width: 250, editable: true },
                    { name: 'TermsOfDelivery', index: 'TermsOfDelivery', label: 'Terms Delivery', width: 250, editable: true },
                    { name: 'TermsOfPayment', index: 'TermsOfPayment', label: 'Terms Payment', width: 250, editable: true },
                    {
                        name: 'IsPending', index: 'IsPending', width: 100, label: 'Pending',
                        editable: true, edittype: 'checkbox', editoptions: { value: "True:False" },
                        formatter: "checkbox", formatoptions: { disabled: false }
                    },
                    {
                        name: 'IsClosed', index: 'IsClosed', label: 'Closed', width: 60,
                        editable: true, edittype: 'checkbox', editoptions: { value: "True:False" },
                        formatter: "checkbox", formatoptions: { disabled: false }
                    },
                    {
                        name: 'WithItemCode', index: 'WithItemCode', width: 100, label: 'With Item Code',
                        editable: true, edittype: 'checkbox', editoptions: { value: "True:False" },
                        formatter: "checkbox", formatoptions: { disabled: false }
                    },
                    {
                        name: 'ValidateQty', index: 'ValidateQty', label: 'Validate Qty', width: 100,
                        editable: true, edittype: 'checkbox', editoptions: { value: "True:False" },
                        formatter: "checkbox", formatoptions: { disabled: false }
                    },

                    {
                        name: 'PO_ID', label: '', search: false, width: '40', frozen: true , formatter: function (cellvalue, options, rowObject, rowdata) {
                            var rowID = rowObject['PO_ID'];
                            if (rowID != null) {

                                return '<a href="javascript:POGetby(' + rowID + ')" style="color: #3366ff" id="' + rowID + '" >Edit</a>';
                            }

                        }
                    },


                ],
                autowidth: true,
                shrinkToFit: false,

                navOptions: {
                    reloadGridOptions: { fromServer: true }
                },
                rowNum: 20,
                loadonce: true,
                height: '250',
                viewrecords: true,
                caption: 'Purchase Order',
                emptyrecords: 'No Records are Available to Display',
                pager: "#jqGridPager",

                onSelectRow: function (ids) {
                    if (ids != null) {
                        var data = $("#jqGrid").getLocalRow(ids);
                        $("#jqGridDetails").jqGrid('setGridParam', { url: "/Home/PODetailGrid/" + data.PO_ID, datatype: 'json' });
                        $("#jqGridDetails").jqGrid('setCaption', 'Purchase Order Detail For :: <b style="color: Red">' + data.PartyName + '</b>');
                        $("#jqGridDetails").trigger("reloadGrid");
                    }
                },

                onSortCol: clearSelection,


            });


        });
如果使用@Html.CheckBoxForm=>m.IsCancelled,new{@id=isuccancelled}和Model.IsCancelled为true,MVC将实际发出两个输入元素:

            <div class="modal-content" style="width:140%">
                <!--Header-->
                <div class="modal-header">
                    <p class="heading lead">Update Purchase Order</p>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true" class="white-text">&times;</span>
                    </button>
                </div>
                <!--Body-->
                <form id="NewOrder">
                    <div class="modal-body">
                        <div class="form-row">
                            <div class="col" id="poidd">
                                <!-- Purchase PO ID -->
                                <div class="md-form">
                                    @Html.TextBoxFor(m=>m.PO_ID, new { @class = "form-control mr-sm-3", @id = "POUID", Required = true })
                                </div>
                            </div>
                            <div class="col">
                                <!-- Purchase PO NO -->
                                <label for="lblPONo" style="font-weight:bold; ">PO No.</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m=>m.PONo, new { @class = "form-control mr-sm-3", @id = "POUNO", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- PO Date -->
                                <label for="lblPODatepicker" style="font-weight:bold; "> PO Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.PODate, new { @class = "form-control", @id = "POUDate", Required = true, @Readonly=true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- Requisition Date -->
                                <label for="lblRequisitionDatepicker" style="font-weight:bold; "> Requisition Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.RequisitionDate, new { @class = "form-control", @id = "RequisitionUDate", Required = true, @Readonly = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- Delivery Date -->
                                <label for="lblDeliveryDatepicker" style="font-weight:bold; "> Delivery Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.DeliveryDate, new { @class = "form-control", @id = "DeliveryUDate", Required = true, @Readonly = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;


                            <div class="col">
                                <!-- IsCancel-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsCancelled, new { @class = "custom-control-input", @id = "IsUCancelled" })

                                    <label class="custom-control-label" for="IsUCancelled">Cancel</label>
                                </div>

                                <!-- IsClosed-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsClosed, new { @class = "custom-control-input", @id = "IsUClosed" })

                                    <label class="custom-control-label" for="IsUClosed">Closed</label>
                                </div>

                                <!-- IsPending-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsPending, new { @class = "custom-control-input", @id = "IsUPending" })

                                    <label class="custom-control-label" for="IsUPending">Pending</label>
                                </div>

                            </div>



                        </div>

                        <div class="form-row">
                            <div class="col">
                                <!-- Party Code -->
                                <div class="md-form">
                                    @Html.DropDownListFor(m => m.PartyCode, ViewBag.PartyCode as List<SelectListItem>, new { @class = "chosen-select", id = "PartyUCode", Required = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;
                            <div class="col" style="margin-left:1.5%;">
                                <!-- SellerQuotRefNo -->
                                <label for="lblSellerQuotRefNo" style="font-weight:bold; ">Seller Quot Ref No.</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.SellerQuotRefNo, new { @class = "form-control", @id = "SellerUQuotRefNo", @placeholder = "SellerQuotRefNo", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.5%;">
                                <!--SellerQuotDate -->
                                <label for="lblSellerQuotDateDatepicker" style="font-weight:bold; "> Seller Quot Date</label>
                                <div class="md-form">

                                    @Html.TextBoxFor(m => m.SellerQuotDate, new { @class = "form-control", @id = "SellerUQuotDate", Required = true, @Readonly = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.8%;">
                                <!-- ComparativeRefNo -->
                                <label for="lblComparativeRefNo" style="font-weight:bold; "> Comparative RefNo</label>
                                <div class="md-form">

                                    @Html.TextBoxFor(m => m.ComparativeRefNo, new { @class = "form-control", @id = "ComparativeURefNo", @placeholder = "ComparativeRefNo", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">

                                <fieldset>
                                    @Html.RadioButtonFor(e => e.WithItemCode, true, new { id = "RUtrue", @checked = true })
                                    @Html.Label("RUtrue", "With Item Code")<br />

                                    @Html.RadioButtonFor(e => e.WithItemCode, false, new { id = "RUfalse" })
                                    @Html.Label("RUfalse", "With GL Code")
                                </fieldset>

                                <!-- IsPending-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.ValidateQty, new { @class = "custom-control-input", @id = "ValidateUQty" })

                                    <label class="custom-control-label" for="ValidateQty">Validate Qty</label>
                                </div>

                            </div>

                        </div>

                        <div class="form-row">

                            <div class="col" style="margin-left:1.5%;">
                                <!--TermsOfDelivery -->
                                <label for="lblTermsOfDelivery" style="font-weight:bold; "> Terms Of Delivery</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfDelivery, new { @class = "form-control", @id = "UTermsOfDelivery", @placeholder = "TermsOfDelivery", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.8%;">
                                <!--TermsOfPayment -->

                                <label for="lblTermsOfPayment" style="font-weight:bold; "> Terms Of Payment</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfPayment, new { @class = "form-control", @id = "UTermsOfPayment", @placeholder = "TermsOfPayment", Required = true })

                                </div>
                            </div>

                            <div class="col" style="margin-left:1.8%;">
                                <!-- TermsOfConditions -->
                                <label for="lblTermsOfConditions" style="font-weight:bold; ">Terms Of Conditions</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfConditions, new { @class = "form-control", @id = "UTermsOfConditions", @placeholder = "TermsOfConditions", Required = true })


                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="reset" class="btn btn-primary" data-dismiss="modal">Close</button>
                            <button id="UpdatePO" type="submit" class="btn btn-primary">Update</button>
                        </div>
                    </div>
                </form>



            </div>

            <!--/.Content-->
        </div>
    </div>
<input id="IsUCancelled" name="IsCancelled" type="checkbox" value="true">
<input name="IsCancelled" type="hidden" value="false">
这是由MVC完成的,因为未选中的复选框不会作为false发回,但ModelBinder希望在任何情况下将IsCancelled绑定到布尔值。因此,发送的第二个隐藏输入的名称与始终设置为false的名称相同

            <div class="modal-content" style="width:140%">
                <!--Header-->
                <div class="modal-header">
                    <p class="heading lead">Update Purchase Order</p>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true" class="white-text">&times;</span>
                    </button>
                </div>
                <!--Body-->
                <form id="NewOrder">
                    <div class="modal-body">
                        <div class="form-row">
                            <div class="col" id="poidd">
                                <!-- Purchase PO ID -->
                                <div class="md-form">
                                    @Html.TextBoxFor(m=>m.PO_ID, new { @class = "form-control mr-sm-3", @id = "POUID", Required = true })
                                </div>
                            </div>
                            <div class="col">
                                <!-- Purchase PO NO -->
                                <label for="lblPONo" style="font-weight:bold; ">PO No.</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m=>m.PONo, new { @class = "form-control mr-sm-3", @id = "POUNO", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- PO Date -->
                                <label for="lblPODatepicker" style="font-weight:bold; "> PO Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.PODate, new { @class = "form-control", @id = "POUDate", Required = true, @Readonly=true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- Requisition Date -->
                                <label for="lblRequisitionDatepicker" style="font-weight:bold; "> Requisition Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.RequisitionDate, new { @class = "form-control", @id = "RequisitionUDate", Required = true, @Readonly = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- Delivery Date -->
                                <label for="lblDeliveryDatepicker" style="font-weight:bold; "> Delivery Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.DeliveryDate, new { @class = "form-control", @id = "DeliveryUDate", Required = true, @Readonly = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;


                            <div class="col">
                                <!-- IsCancel-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsCancelled, new { @class = "custom-control-input", @id = "IsUCancelled" })

                                    <label class="custom-control-label" for="IsUCancelled">Cancel</label>
                                </div>

                                <!-- IsClosed-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsClosed, new { @class = "custom-control-input", @id = "IsUClosed" })

                                    <label class="custom-control-label" for="IsUClosed">Closed</label>
                                </div>

                                <!-- IsPending-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsPending, new { @class = "custom-control-input", @id = "IsUPending" })

                                    <label class="custom-control-label" for="IsUPending">Pending</label>
                                </div>

                            </div>



                        </div>

                        <div class="form-row">
                            <div class="col">
                                <!-- Party Code -->
                                <div class="md-form">
                                    @Html.DropDownListFor(m => m.PartyCode, ViewBag.PartyCode as List<SelectListItem>, new { @class = "chosen-select", id = "PartyUCode", Required = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;
                            <div class="col" style="margin-left:1.5%;">
                                <!-- SellerQuotRefNo -->
                                <label for="lblSellerQuotRefNo" style="font-weight:bold; ">Seller Quot Ref No.</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.SellerQuotRefNo, new { @class = "form-control", @id = "SellerUQuotRefNo", @placeholder = "SellerQuotRefNo", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.5%;">
                                <!--SellerQuotDate -->
                                <label for="lblSellerQuotDateDatepicker" style="font-weight:bold; "> Seller Quot Date</label>
                                <div class="md-form">

                                    @Html.TextBoxFor(m => m.SellerQuotDate, new { @class = "form-control", @id = "SellerUQuotDate", Required = true, @Readonly = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.8%;">
                                <!-- ComparativeRefNo -->
                                <label for="lblComparativeRefNo" style="font-weight:bold; "> Comparative RefNo</label>
                                <div class="md-form">

                                    @Html.TextBoxFor(m => m.ComparativeRefNo, new { @class = "form-control", @id = "ComparativeURefNo", @placeholder = "ComparativeRefNo", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">

                                <fieldset>
                                    @Html.RadioButtonFor(e => e.WithItemCode, true, new { id = "RUtrue", @checked = true })
                                    @Html.Label("RUtrue", "With Item Code")<br />

                                    @Html.RadioButtonFor(e => e.WithItemCode, false, new { id = "RUfalse" })
                                    @Html.Label("RUfalse", "With GL Code")
                                </fieldset>

                                <!-- IsPending-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.ValidateQty, new { @class = "custom-control-input", @id = "ValidateUQty" })

                                    <label class="custom-control-label" for="ValidateQty">Validate Qty</label>
                                </div>

                            </div>

                        </div>

                        <div class="form-row">

                            <div class="col" style="margin-left:1.5%;">
                                <!--TermsOfDelivery -->
                                <label for="lblTermsOfDelivery" style="font-weight:bold; "> Terms Of Delivery</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfDelivery, new { @class = "form-control", @id = "UTermsOfDelivery", @placeholder = "TermsOfDelivery", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.8%;">
                                <!--TermsOfPayment -->

                                <label for="lblTermsOfPayment" style="font-weight:bold; "> Terms Of Payment</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfPayment, new { @class = "form-control", @id = "UTermsOfPayment", @placeholder = "TermsOfPayment", Required = true })

                                </div>
                            </div>

                            <div class="col" style="margin-left:1.8%;">
                                <!-- TermsOfConditions -->
                                <label for="lblTermsOfConditions" style="font-weight:bold; ">Terms Of Conditions</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfConditions, new { @class = "form-control", @id = "UTermsOfConditions", @placeholder = "TermsOfConditions", Required = true })


                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="reset" class="btn btn-primary" data-dismiss="modal">Close</button>
                            <button id="UpdatePO" type="submit" class="btn btn-primary">Update</button>
                        </div>
                    </div>
                </form>



            </div>

            <!--/.Content-->
        </div>
    </div>
正如您所看到的,您用新的{@ID=IsUCancelled}覆盖的ID仅为复选框发出,而不是为隐藏的输入发出

            <div class="modal-content" style="width:140%">
                <!--Header-->
                <div class="modal-header">
                    <p class="heading lead">Update Purchase Order</p>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true" class="white-text">&times;</span>
                    </button>
                </div>
                <!--Body-->
                <form id="NewOrder">
                    <div class="modal-body">
                        <div class="form-row">
                            <div class="col" id="poidd">
                                <!-- Purchase PO ID -->
                                <div class="md-form">
                                    @Html.TextBoxFor(m=>m.PO_ID, new { @class = "form-control mr-sm-3", @id = "POUID", Required = true })
                                </div>
                            </div>
                            <div class="col">
                                <!-- Purchase PO NO -->
                                <label for="lblPONo" style="font-weight:bold; ">PO No.</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m=>m.PONo, new { @class = "form-control mr-sm-3", @id = "POUNO", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- PO Date -->
                                <label for="lblPODatepicker" style="font-weight:bold; "> PO Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.PODate, new { @class = "form-control", @id = "POUDate", Required = true, @Readonly=true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- Requisition Date -->
                                <label for="lblRequisitionDatepicker" style="font-weight:bold; "> Requisition Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.RequisitionDate, new { @class = "form-control", @id = "RequisitionUDate", Required = true, @Readonly = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- Delivery Date -->
                                <label for="lblDeliveryDatepicker" style="font-weight:bold; "> Delivery Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.DeliveryDate, new { @class = "form-control", @id = "DeliveryUDate", Required = true, @Readonly = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;


                            <div class="col">
                                <!-- IsCancel-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsCancelled, new { @class = "custom-control-input", @id = "IsUCancelled" })

                                    <label class="custom-control-label" for="IsUCancelled">Cancel</label>
                                </div>

                                <!-- IsClosed-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsClosed, new { @class = "custom-control-input", @id = "IsUClosed" })

                                    <label class="custom-control-label" for="IsUClosed">Closed</label>
                                </div>

                                <!-- IsPending-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsPending, new { @class = "custom-control-input", @id = "IsUPending" })

                                    <label class="custom-control-label" for="IsUPending">Pending</label>
                                </div>

                            </div>



                        </div>

                        <div class="form-row">
                            <div class="col">
                                <!-- Party Code -->
                                <div class="md-form">
                                    @Html.DropDownListFor(m => m.PartyCode, ViewBag.PartyCode as List<SelectListItem>, new { @class = "chosen-select", id = "PartyUCode", Required = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;
                            <div class="col" style="margin-left:1.5%;">
                                <!-- SellerQuotRefNo -->
                                <label for="lblSellerQuotRefNo" style="font-weight:bold; ">Seller Quot Ref No.</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.SellerQuotRefNo, new { @class = "form-control", @id = "SellerUQuotRefNo", @placeholder = "SellerQuotRefNo", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.5%;">
                                <!--SellerQuotDate -->
                                <label for="lblSellerQuotDateDatepicker" style="font-weight:bold; "> Seller Quot Date</label>
                                <div class="md-form">

                                    @Html.TextBoxFor(m => m.SellerQuotDate, new { @class = "form-control", @id = "SellerUQuotDate", Required = true, @Readonly = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.8%;">
                                <!-- ComparativeRefNo -->
                                <label for="lblComparativeRefNo" style="font-weight:bold; "> Comparative RefNo</label>
                                <div class="md-form">

                                    @Html.TextBoxFor(m => m.ComparativeRefNo, new { @class = "form-control", @id = "ComparativeURefNo", @placeholder = "ComparativeRefNo", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">

                                <fieldset>
                                    @Html.RadioButtonFor(e => e.WithItemCode, true, new { id = "RUtrue", @checked = true })
                                    @Html.Label("RUtrue", "With Item Code")<br />

                                    @Html.RadioButtonFor(e => e.WithItemCode, false, new { id = "RUfalse" })
                                    @Html.Label("RUfalse", "With GL Code")
                                </fieldset>

                                <!-- IsPending-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.ValidateQty, new { @class = "custom-control-input", @id = "ValidateUQty" })

                                    <label class="custom-control-label" for="ValidateQty">Validate Qty</label>
                                </div>

                            </div>

                        </div>

                        <div class="form-row">

                            <div class="col" style="margin-left:1.5%;">
                                <!--TermsOfDelivery -->
                                <label for="lblTermsOfDelivery" style="font-weight:bold; "> Terms Of Delivery</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfDelivery, new { @class = "form-control", @id = "UTermsOfDelivery", @placeholder = "TermsOfDelivery", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.8%;">
                                <!--TermsOfPayment -->

                                <label for="lblTermsOfPayment" style="font-weight:bold; "> Terms Of Payment</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfPayment, new { @class = "form-control", @id = "UTermsOfPayment", @placeholder = "TermsOfPayment", Required = true })

                                </div>
                            </div>

                            <div class="col" style="margin-left:1.8%;">
                                <!-- TermsOfConditions -->
                                <label for="lblTermsOfConditions" style="font-weight:bold; ">Terms Of Conditions</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfConditions, new { @class = "form-control", @id = "UTermsOfConditions", @placeholder = "TermsOfConditions", Required = true })


                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="reset" class="btn btn-primary" data-dismiss="modal">Close</button>
                            <button id="UpdatePO" type="submit" class="btn btn-primary">Update</button>
                        </div>
                    </div>
                </form>



            </div>

            <!--/.Content-->
        </div>
    </div>
因此,我猜想您的JS代码只会更改可见复选框的值,而不会更改隐藏输入的值。因为表单数据是使用name属性发送的,所以post数据可能不包含所需的值

            <div class="modal-content" style="width:140%">
                <!--Header-->
                <div class="modal-header">
                    <p class="heading lead">Update Purchase Order</p>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true" class="white-text">&times;</span>
                    </button>
                </div>
                <!--Body-->
                <form id="NewOrder">
                    <div class="modal-body">
                        <div class="form-row">
                            <div class="col" id="poidd">
                                <!-- Purchase PO ID -->
                                <div class="md-form">
                                    @Html.TextBoxFor(m=>m.PO_ID, new { @class = "form-control mr-sm-3", @id = "POUID", Required = true })
                                </div>
                            </div>
                            <div class="col">
                                <!-- Purchase PO NO -->
                                <label for="lblPONo" style="font-weight:bold; ">PO No.</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m=>m.PONo, new { @class = "form-control mr-sm-3", @id = "POUNO", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- PO Date -->
                                <label for="lblPODatepicker" style="font-weight:bold; "> PO Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.PODate, new { @class = "form-control", @id = "POUDate", Required = true, @Readonly=true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- Requisition Date -->
                                <label for="lblRequisitionDatepicker" style="font-weight:bold; "> Requisition Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.RequisitionDate, new { @class = "form-control", @id = "RequisitionUDate", Required = true, @Readonly = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- Delivery Date -->
                                <label for="lblDeliveryDatepicker" style="font-weight:bold; "> Delivery Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.DeliveryDate, new { @class = "form-control", @id = "DeliveryUDate", Required = true, @Readonly = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;


                            <div class="col">
                                <!-- IsCancel-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsCancelled, new { @class = "custom-control-input", @id = "IsUCancelled" })

                                    <label class="custom-control-label" for="IsUCancelled">Cancel</label>
                                </div>

                                <!-- IsClosed-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsClosed, new { @class = "custom-control-input", @id = "IsUClosed" })

                                    <label class="custom-control-label" for="IsUClosed">Closed</label>
                                </div>

                                <!-- IsPending-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsPending, new { @class = "custom-control-input", @id = "IsUPending" })

                                    <label class="custom-control-label" for="IsUPending">Pending</label>
                                </div>

                            </div>



                        </div>

                        <div class="form-row">
                            <div class="col">
                                <!-- Party Code -->
                                <div class="md-form">
                                    @Html.DropDownListFor(m => m.PartyCode, ViewBag.PartyCode as List<SelectListItem>, new { @class = "chosen-select", id = "PartyUCode", Required = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;
                            <div class="col" style="margin-left:1.5%;">
                                <!-- SellerQuotRefNo -->
                                <label for="lblSellerQuotRefNo" style="font-weight:bold; ">Seller Quot Ref No.</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.SellerQuotRefNo, new { @class = "form-control", @id = "SellerUQuotRefNo", @placeholder = "SellerQuotRefNo", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.5%;">
                                <!--SellerQuotDate -->
                                <label for="lblSellerQuotDateDatepicker" style="font-weight:bold; "> Seller Quot Date</label>
                                <div class="md-form">

                                    @Html.TextBoxFor(m => m.SellerQuotDate, new { @class = "form-control", @id = "SellerUQuotDate", Required = true, @Readonly = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.8%;">
                                <!-- ComparativeRefNo -->
                                <label for="lblComparativeRefNo" style="font-weight:bold; "> Comparative RefNo</label>
                                <div class="md-form">

                                    @Html.TextBoxFor(m => m.ComparativeRefNo, new { @class = "form-control", @id = "ComparativeURefNo", @placeholder = "ComparativeRefNo", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">

                                <fieldset>
                                    @Html.RadioButtonFor(e => e.WithItemCode, true, new { id = "RUtrue", @checked = true })
                                    @Html.Label("RUtrue", "With Item Code")<br />

                                    @Html.RadioButtonFor(e => e.WithItemCode, false, new { id = "RUfalse" })
                                    @Html.Label("RUfalse", "With GL Code")
                                </fieldset>

                                <!-- IsPending-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.ValidateQty, new { @class = "custom-control-input", @id = "ValidateUQty" })

                                    <label class="custom-control-label" for="ValidateQty">Validate Qty</label>
                                </div>

                            </div>

                        </div>

                        <div class="form-row">

                            <div class="col" style="margin-left:1.5%;">
                                <!--TermsOfDelivery -->
                                <label for="lblTermsOfDelivery" style="font-weight:bold; "> Terms Of Delivery</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfDelivery, new { @class = "form-control", @id = "UTermsOfDelivery", @placeholder = "TermsOfDelivery", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.8%;">
                                <!--TermsOfPayment -->

                                <label for="lblTermsOfPayment" style="font-weight:bold; "> Terms Of Payment</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfPayment, new { @class = "form-control", @id = "UTermsOfPayment", @placeholder = "TermsOfPayment", Required = true })

                                </div>
                            </div>

                            <div class="col" style="margin-left:1.8%;">
                                <!-- TermsOfConditions -->
                                <label for="lblTermsOfConditions" style="font-weight:bold; ">Terms Of Conditions</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfConditions, new { @class = "form-control", @id = "UTermsOfConditions", @placeholder = "TermsOfConditions", Required = true })


                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="reset" class="btn btn-primary" data-dismiss="modal">Close</button>
                            <button id="UpdatePO" type="submit" class="btn btn-primary">Update</button>
                        </div>
                    </div>
                </form>



            </div>

            <!--/.Content-->
        </div>
    </div>

底线是:不要覆盖Id,否则它会变得非常混乱。

您没有从SqlDataAdapter中选择IsPending到其各自的mPOi属性,我已经在我自己的代码中添加了IsPending值为true,但复选框未选中show。何时调用POMain_select方法?何时使用断点和检查值IsPending或其他ispending value show true但不在前端显示-这是一个值。当单击编辑按钮时,然后调用POMain_Select方法。我已删除id value true但未选中复选框。问题是:$'IsCancelled'。如果写入$IsCancelled,则val val无法获取复选框状态。is:checked;然后问题解决了。
            <div class="modal-content" style="width:140%">
                <!--Header-->
                <div class="modal-header">
                    <p class="heading lead">Update Purchase Order</p>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true" class="white-text">&times;</span>
                    </button>
                </div>
                <!--Body-->
                <form id="NewOrder">
                    <div class="modal-body">
                        <div class="form-row">
                            <div class="col" id="poidd">
                                <!-- Purchase PO ID -->
                                <div class="md-form">
                                    @Html.TextBoxFor(m=>m.PO_ID, new { @class = "form-control mr-sm-3", @id = "POUID", Required = true })
                                </div>
                            </div>
                            <div class="col">
                                <!-- Purchase PO NO -->
                                <label for="lblPONo" style="font-weight:bold; ">PO No.</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m=>m.PONo, new { @class = "form-control mr-sm-3", @id = "POUNO", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- PO Date -->
                                <label for="lblPODatepicker" style="font-weight:bold; "> PO Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.PODate, new { @class = "form-control", @id = "POUDate", Required = true, @Readonly=true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- Requisition Date -->
                                <label for="lblRequisitionDatepicker" style="font-weight:bold; "> Requisition Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.RequisitionDate, new { @class = "form-control", @id = "RequisitionUDate", Required = true, @Readonly = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">
                                <!-- Delivery Date -->
                                <label for="lblDeliveryDatepicker" style="font-weight:bold; "> Delivery Date</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.DeliveryDate, new { @class = "form-control", @id = "DeliveryUDate", Required = true, @Readonly = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;


                            <div class="col">
                                <!-- IsCancel-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsCancelled, new { @class = "custom-control-input", @id = "IsUCancelled" })

                                    <label class="custom-control-label" for="IsUCancelled">Cancel</label>
                                </div>

                                <!-- IsClosed-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsClosed, new { @class = "custom-control-input", @id = "IsUClosed" })

                                    <label class="custom-control-label" for="IsUClosed">Closed</label>
                                </div>

                                <!-- IsPending-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.IsPending, new { @class = "custom-control-input", @id = "IsUPending" })

                                    <label class="custom-control-label" for="IsUPending">Pending</label>
                                </div>

                            </div>



                        </div>

                        <div class="form-row">
                            <div class="col">
                                <!-- Party Code -->
                                <div class="md-form">
                                    @Html.DropDownListFor(m => m.PartyCode, ViewBag.PartyCode as List<SelectListItem>, new { @class = "chosen-select", id = "PartyUCode", Required = true })
                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;
                            <div class="col" style="margin-left:1.5%;">
                                <!-- SellerQuotRefNo -->
                                <label for="lblSellerQuotRefNo" style="font-weight:bold; ">Seller Quot Ref No.</label>
                                <div class="md-form">
                                    @Html.TextBoxFor(m => m.SellerQuotRefNo, new { @class = "form-control", @id = "SellerUQuotRefNo", @placeholder = "SellerQuotRefNo", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.5%;">
                                <!--SellerQuotDate -->
                                <label for="lblSellerQuotDateDatepicker" style="font-weight:bold; "> Seller Quot Date</label>
                                <div class="md-form">

                                    @Html.TextBoxFor(m => m.SellerQuotDate, new { @class = "form-control", @id = "SellerUQuotDate", Required = true, @Readonly = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.8%;">
                                <!-- ComparativeRefNo -->
                                <label for="lblComparativeRefNo" style="font-weight:bold; "> Comparative RefNo</label>
                                <div class="md-form">

                                    @Html.TextBoxFor(m => m.ComparativeRefNo, new { @class = "form-control", @id = "ComparativeURefNo", @placeholder = "ComparativeRefNo", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col">

                                <fieldset>
                                    @Html.RadioButtonFor(e => e.WithItemCode, true, new { id = "RUtrue", @checked = true })
                                    @Html.Label("RUtrue", "With Item Code")<br />

                                    @Html.RadioButtonFor(e => e.WithItemCode, false, new { id = "RUfalse" })
                                    @Html.Label("RUfalse", "With GL Code")
                                </fieldset>

                                <!-- IsPending-->
                                <div class="custom-control custom-checkbox custom-control-inline">
                                    @Html.CheckBoxFor(m => m.ValidateQty, new { @class = "custom-control-input", @id = "ValidateUQty" })

                                    <label class="custom-control-label" for="ValidateQty">Validate Qty</label>
                                </div>

                            </div>

                        </div>

                        <div class="form-row">

                            <div class="col" style="margin-left:1.5%;">
                                <!--TermsOfDelivery -->
                                <label for="lblTermsOfDelivery" style="font-weight:bold; "> Terms Of Delivery</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfDelivery, new { @class = "form-control", @id = "UTermsOfDelivery", @placeholder = "TermsOfDelivery", Required = true })


                                </div>
                            </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <div class="col" style="margin-left:1.8%;">
                                <!--TermsOfPayment -->

                                <label for="lblTermsOfPayment" style="font-weight:bold; "> Terms Of Payment</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfPayment, new { @class = "form-control", @id = "UTermsOfPayment", @placeholder = "TermsOfPayment", Required = true })

                                </div>
                            </div>

                            <div class="col" style="margin-left:1.8%;">
                                <!-- TermsOfConditions -->
                                <label for="lblTermsOfConditions" style="font-weight:bold; ">Terms Of Conditions</label>
                                <div class="md-form">

                                    @Html.TextAreaFor(m => m.TermsOfConditions, new { @class = "form-control", @id = "UTermsOfConditions", @placeholder = "TermsOfConditions", Required = true })


                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="reset" class="btn btn-primary" data-dismiss="modal">Close</button>
                            <button id="UpdatePO" type="submit" class="btn btn-primary">Update</button>
                        </div>
                    </div>
                </form>



            </div>

            <!--/.Content-->
        </div>
    </div>