Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 引导切换chechkbox在与html帮助程序chechkboxfor一起使用时不起作用?_C#_Asp.net Mvc_Twitter Bootstrap - Fatal编程技术网

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