Your search did not match any results.

Overview

The NumberBox is a component that displays a number. Users can change this number (for example, type a new value or use the spin buttons, keyboard arrows, or mouse wheel to increment/decrement it).

Use the value property to specify the number displayed in the NumberBox. If you do not specify the value property, the NumberBox displays 0 (the default value). You can use the min and max properties to set the value range.

Specify the onValueChanged function to handle the value change. In this demo, the value of the "Stock" NumberBox depends on the "This month sales" NumberBox. Change the value in the "This month sales" NumberBox to see how it affects the other value.

If users should not interact with a NumberBox, set its disabled or readOnly property to true. The main difference between these properties is that users can submit a read-only NumberBox in an HTML form, while they cannot submit a disabled NumberBox.

Backend API
<div class="form"> <div class="dx-fieldset"> <div class="dx-field"> <div class="dx-field-label">Default mode</div> <div class="dx-field-value"> @(Html.DevExtreme().NumberBox()) </div> </div> <div class="dx-field"> <div class="dx-field-label">With spin and clear buttons</div> <div class="dx-field-value"> @(Html.DevExtreme().NumberBox() .Value(20.5) .InputAttr("aria-label", "With Spin And Buttons") .ShowSpinButtons(true) .ShowClearButton(true) ) </div> </div> <div class="dx-field"> <div class="dx-field-label">Disabled</div> <div class="dx-field-value"> @(Html.DevExtreme().NumberBox() .Value(20.5) .ShowSpinButtons(true) .ShowClearButton(true) .InputAttr("aria-label", "Disabled") .Disabled(true) ) </div> </div> <div class="dx-field"> <div class="dx-field-label">With max and min values</div> <div class="dx-field-value"> @(Html.DevExtreme().NumberBox() .Value(15) .Min(10) .InputAttr("aria-label", "Max And Min") .Max(20) .ShowSpinButtons(true) ) </div> </div> </div> <div class="dx-fieldset"> <div class="dx-fieldset-header">Event Handling</div> <div class="dx-field"> <div class="dx-field-label">This month sales</div> <div class="dx-field-value"> @(Html.DevExtreme().NumberBox() .Max(30) .Min(0) .Value(16) .ShowSpinButtons(true) .InputAttr("aria-label", "Sales") .OnKeyDown("key_down") .OnValueChanged("numberBox_valueChanged") ) </div> </div> <div class="dx-field"> <div class="dx-field-label">Stock</div> <div class="dx-field-value"> @(Html.DevExtreme().NumberBox() .ID("stock") .Value(14) .Min(0) .InputAttr("aria-label", "Stock") .ShowSpinButtons(false) .ReadOnly(true) ) </div> </div> </div> </div> <script> var totalProductQuantity = 30; function key_down(e) { var event = e.jQueryEvent, str = event.key || String.fromCharCode(event.which); if(/^[.,e]$/.test(str)) { event.preventDefault(); } } function numberBox_valueChanged(data) { $("#stock").dxNumberBox("instance").option("value", totalProductQuantity - data.value); } </script>
using System.Web.Mvc; namespace DevExtreme.MVC.Demos.Controllers { public class NumberBoxController : Controller { public ActionResult Overview() { return View(); } } }