Skip to main content

SpinEditFor

SpinEditFor enables your end-users to edit numeric values with ease. The editor consists of an edit region and one or two pairs of spin buttons that can be used to adjust the numerical value.

Implementation Details

SpinEditFor is realized by the SpinEditExtension class. Its instance can be accessed via the ExtensionsFactory<ModelType>.SpinEditFor<ValueType> helper method, which is used to add a SpinEditFor extension to a view. This first method’s parameter is an expression that identifies model property to display and edit. The second method’s parameter provides access to the SpinEditFor‘s settings implemented by the SpinEditSettings class, allowing you to fully customize the extension.

SpinEditFor‘s client counterpart is represented by the ASPxClientSpinEdit object.

Declaration

SpinEditFor can be added to a view in the following manner.

@Html.DevExpress().SpinEditFor(model => model.Price,
    settings => {
        settings.Properties.SpinButtons.ShowLargeIncrementButtons = true;
        settings.Properties.Increment = 0.1M;
        settings.Properties.LargeIncrement = 1;

        settings.Properties.DisplayFormatString = "C";
        settings.Properties.NumberType = SpinEditNumberType.Float;
    }).GetHtml()

The code result is demonstrated in the image below.

spinedit-declaration.png

See Also