首页 > 解决方案 > 如何在 nopcommerce 4.3 中设置默认选中单选按钮

问题描述

我想在 nopcommerce 4.3 中从三个选项中默认检查一个单选按钮

这是我的代码,

<div class="col-md-6">
    <div class="raw">
        <div class="col-md-2">
            <div class="radio">
                <label>
                    @Html.RadioButton("LabourChargeUnit", "false", (Model.LabourChargeUnit == "PCS"), new { id = "LabourChargeUnit_PCS"})
                    @T("Admin.Catalog.Product.Fields.LabourChargeUnit.PCS")
                </label>
            </div>
        </div>
        <div class="col-md-2">
            <div class="radio">
                <label>
                    @Html.RadioButton("LabourChargeUnit", "false", (Model.LabourChargeUnit == "PER"), new { id = "LabourChargeUnit_PER" })
                    @T("Admin.Catalog.Product.Fields.LabourChargeUnit.PER")
                </label>
            </div>
        </div>
        <div class="col-md-2">
            <div class="radio">
                <label>
                    @Html.RadioButton("LabourChargeUnit", "true", (Model.LabourChargeUnit == "GM"), new { id = "LabourChargeUnit_GM" })
                    @T("Admin.Catalog.Product.Fields.LabourChargeUnit.GM")
                </label>
            </div>
        </div>
    </div>
</div>

现在,我尝试了很多东西,比如new{@checked = "checked"}, true/false, 0/1但没有用。

标签: htmlasp.net-mvcradio-buttonnopcommercechecked

解决方案


@T("帐户.字段.性别.男性")

@T("账户.字段.性别.女性")


推荐阅读