In my asp.net mvc application, in the form there are couple of inputs I have created.
Here I also using theme and I want to change my check box for model.Add_GeneralRequest
to switch button.
I found a switch button from the theme I have using, but I got troubling adding that style to this existing code.
This is my html code.
<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>
This is the class that I got from the theme,
<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>
I have added all scripts to the view, but It won't works like wise in the theme switch works. Also I want to know how to apply this switch for the required column (model.Add_GeneralRequest this should update true or false from the switch ) .