c# - 将引导开关应用于复选框
问题描述
在我的 asp.net mvc 应用程序中,表单中有我创建的几个输入。
在这里我也使用主题,我想更改我的复选框model.Add_GeneralRequest
以切换按钮。
我从我使用的主题中找到了一个切换按钮,但我很难将这种风格添加到现有代码中。
这是我的html代码。
<div class="form-group">
@Html.LabelFor(model => model.Add_GeneralRequest, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
<div class="checkbox">
@Html.EditorFor(model => model.Add_GeneralRequest)
@Html.ValidationMessageFor(model => model.Add_GeneralRequest, "", new { @class = "text-danger" })
</div>
</div>
</div>
这是我从主题中得到的课程,
<div class="bootstrap-switch bootstrap-switch-wrapper bootstrap-switch-animate bootstrap-switch-on bootstrap-switch-focused" style="width: 86px;">
<div class="bootstrap-switch-container" style="width: 126px; margin-left: 0px;">
<span class="bootstrap-switch-handle-on bootstrap-switch-success" style="width: 42px;">ON</span>
<span class="bootstrap-switch-label" style="width: 42px;">
</span>
<span class="bootstrap-switch-handle-off bootstrap-switch-danger" style="width: 42px;">OFF</span>
<input type="checkbox" name="my-checkbox" checked="" data-bootstrap-switch="" data-off-color="danger" data-on-color="success"></div></div>
我已将所有脚本添加到视图中,但在主题切换工作中它不会像明智的那样工作。另外我想知道如何将此开关应用于所需的列(model.Add_GeneralRequest 这应该从开关更新 true 或 false)。
解决方案
推荐阅读
- laravel - 如果我保存在数组 laravel 中,如何解码 json 数据?
- git - github 上的存储库可以由 2 个用户拥有吗?
- c# - 英雄卡按钮 PostBack
- java - 如何强制 Zookeeper 服务器等到客户端读取响应?
- apache - apache 基于名称的虚拟主机是如何工作的
- java - 使用 Apache Commons compress 解压缩 Tar 文件时发生异常
- java - okhttp java.lang.Illegal ArgumentException:意外的 url
- python - 使用 python 请求编写带有 -u 和 -T 等参数的 curl 命令
- arrays - 使用数组作为新对象不起作用
- java - maven项目中如何定义常用配置