C# 引导切换chechkbox在与html帮助程序chechkboxfor一起使用时不起作用?
我正在使用C# 引导切换chechkbox在与html帮助程序chechkboxfor一起使用时不起作用?,c#,asp.net-mvc,twitter-bootstrap,C#,Asp.net Mvc,Twitter Bootstrap,我正在使用@Html.CheckBoxFor并尝试在此Html帮助程序上应用引导类,但当我在此帮助程序上应用引导类时,它将变为只读。您能否帮助我如何在数据库中使用MVC控制器提交1或0 @Html.CheckBoxFor(m => m.IsStreamProcessing, new { @class = "custom-control-input" } ) <label class="custom-control-label" for="customSwitch1">Stre
@Html.CheckBoxFor
并尝试在此Html帮助程序上应用引导类,但当我在此帮助程序上应用引导类时,它将变为只读。您能否帮助我如何在数据库中使用MVC控制器提交1或0
@Html.CheckBoxFor(m => m.IsStreamProcessing, new { @class = "custom-control-input" } )
<label class="custom-control-label" for="customSwitch1">Stream Processing</label>
@Html.CheckBoxFor(m=>m.IsStreamProcessing,新的{@class=“自定义控件输入”})
流处理
既然您已经在使用引导,我建议您改用它,它应该可以正常工作:
@Html.CheckBoxFor(x => item.IsStreamProcessing, new { data_toggle = "toggle",
data_onstyle = "success" })
但是,您需要参考以下内容:
<link href="https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css" rel="stylesheet">
<script src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js"></script>
工作正常。我看不出有什么问题?我得到一个样式的复选框。您是否将其包装在
中?id与标签customSwitch1
和IsStreamProcessing