Bootstrap切换chechkbox与html helper chechkboxfor一起使用时不起作用?

nado1122

我正在使用@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>
错误的Akbari

由于您已经在使用Bootstrap,因此建议您改用Bootstrap Toggle,它应该可以正常工作:

@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>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章