Is there anyway to convert the @HTML.Checkboxfor into toggle html button? I have refer the toggle button style from https://www.w3schools.com/howto/howto_css_switch.asp
Currently its working by using :
@Html.CheckBoxFor(model => model.IsEnabled, new { @checked = "checked", @Name = "DelegateChkBox" })
Changed to:
<td class="slider-td">
<label class="switch">
<input name="DelegateChkBox" id="IsEnabled" type="checkbox" value="true" data-val-required="The IsEnabled field is required." data-val="true" data-bind="checked: IsEnabled">
<div class="slider round"></div>
</label>
</td>
The toggle button only works and postback to controller if it's CHECKED:
else it won't postback to controller by default UNCHECKED :
Any help will be appreciated! Thanks!