ASP.NET RAZOR-如何在自定义Boostrap 4复选框开关上绑定剃须刀复选框 [英] ASP.NET RAZOR - How to Bind razor checkBox on custom Boostrap 4 Checkbox Switch
本文介绍了ASP.NET RAZOR-如何在自定义Boostrap 4复选框开关上绑定剃须刀复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何将剃刀产生的代码放在此开关上?
How would I put the codes generated by the razor on this switch?
它将像ckeckbox一样工作
It would work like the ckeckbox
以下是其工作原理的链接: https://bootsnipp.com/snippets/GaxR2
An here is the link how its work: https://bootsnipp.com/snippets/GaxR2
<div class="card" style="margin:50px 0">
<div class="card-header">Checkbox to Switch</div>
<ul class="list-group list-group-flush">
<li class="list-group-item">
Bootstrap Switch Success
<label class="switch ">
<input type="checkbox" class="success">
<span class="slider"></span>
</label>
</li>
</ul>
</div>
剃刀代码
<div class="form-group">
@Html.LabelFor(model => model.ExibirInfoPosicionamento, htmlAttributes: new { @class = "control-label " })
<div class="col-md-10">
@Html.CheckBoxFor(model => model.ExibirInfoPosicionamento, new { })
</div>
</div>
推荐答案
来晚了,但我对此也感到沮丧,让它像这样工作(Bootstrap 4.3.1)
Little late but I had some frustration with this too, got it working like this (Bootstrap 4.3.1)
页面上的剃刀-
<div class="col-lg-1">
@Html.EditorFor(m => Model.YN,"toggle", new { @id = "yn1 })
</div>
编辑器模板切换"
@model System.Boolean
<div class="custom-control custom-switch">
@Html.CheckBoxFor(m => m,
new { @class = "custom-control-input" })
@Html.LabelFor(m => m, new { @class = "custom-control-label" })
</div>
这篇关于ASP.NET RAZOR-如何在自定义Boostrap 4复选框开关上绑定剃须刀复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文