Your search did not match any results.

Switch

The Switch component can be in two states: ON (when the value is true) and OFF (when the value is false). To respond to value changes, assign the handling function to the onValueChanged property.

If you want to change the Switch text, specify the switchedOnText and the switchedOffText properties. If the changed text does not fit in the component, use the width property.

Set the disabled property to true to disable the component.

Backend API
<div class="form"> <div class="dx-fieldset"> <div class="dx-field"> <div class="dx-field-label">Switched on</div> <div class="dx-field-value"> @(Html.DevExtreme().Switch() .Value(true) ) </div> </div> <div class="dx-field"> <div class="dx-field-label">Switched off</div> <div class="dx-field-value"> @(Html.DevExtreme().Switch() .Value(false) ) </div> </div> <div class="dx-field"> <div class="dx-field-label">Value change handling</div> <div class="dx-field-value"> @(Html.DevExtreme().Switch() .OnValueChanged("switch_valueChanged") ) </div> </div> <div class="dx-field"> <div class="dx-field-label">Disabled</div> <div class="dx-field-value"> @(Html.DevExtreme().Switch() .ID("disabled") .Value(false) .Disabled(true) ) </div> </div> </div> </div> <script> function switch_valueChanged(data) { $("#disabled").dxSwitch("instance").option("value", data.value) } </script>
using System.Web.Mvc; namespace DevExtreme.MVC.Demos.Controllers { public class SwitchController : Controller { public ActionResult Overview() { return View(); } } }