Back to Devexpress

SpinEditProperties.NumberType Property

aspnet-devexpress-dot-web-dot-spineditproperties.md

latest4.0 KB
Original Source

SpinEditProperties.NumberType Property

Gets or sets a value that specifies whether a spin editor edits float or integer values.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue(SpinEditNumberType.Float)]
public SpinEditNumberType NumberType { get; set; }
vb
<DefaultValue(SpinEditNumberType.Float)>
Public Property NumberType As SpinEditNumberType

Property Value

TypeDefaultDescription
SpinEditNumberTypeFloat

A SpinEditNumberType enumeration value.

|

Available values:

NameDescription
Integer

Float value input is disabled and float values displayed within the editor are automatically rounded after they has been modified.

| | Float |

Float value input is enabled.

|

Remarks

A spin editor can function in float or integer editing mode, which is controlled by the NumberType property.

In integer mode (when the NumberType property is set to SpinEditNumberType.Integer), floating value inputs are disabled. In this mode, the editor can display float values (assigned to it via code, for instance), but these values are automatically rounded to integers after they have been modified within the editor.

In float mode (when the NumberType property is set to SpinEditNumberType.Float), floating values can be displayed and customized within the editor along with integer values. Culture specific decimal separators are supported in this mode. The number of decimal places can be defined using the SpinEditProperties.DecimalPlaces property.

Note

If the NumberType property value does not correspond to the real type of value to which the editor is bound (e.g., the NumberType property is set to Integer and the editor is bound to the Double value), the spin editor may work improperly. So, we recommend you correlate the NumberType property value with the real editor value type.

The NumberType property synchronizes its value with the editor’s ASPxSpinEdit.NumberType property.

Example

Note

For a full example, see the GridView - Customization Dialog demo.

cshtml
@Html.DevExpress().GridView(settings => {
    settings.Name = "GridView";
    settings.SettingsCustomizationDialog.Enabled = true;
    ...
    settings.Columns.Add(c => {
        c.FieldName = "UnitPrice";
        c.SortIndex = 0;
        c.SortOrder = DevExpress.Data.ColumnSortOrder.Ascending;
        c.Width = 120;
        c.EditorProperties().SpinEdit(sp => {
            sp.DisplayFormatString = "c";
            sp.MinValue = 0;
            sp.MaxValue = 60000;
        });
    });
    settings.Columns.Add(c => {
        c.FieldName = "UnitsInStock";
        c.Width = 140;
        c.EditorProperties().SpinEdit(sp => {
            sp.NumberType = SpinEditNumberType.Integer;
            sp.MinValue = 0;
            sp.MaxValue = 10000;
        });
    });

}).Bind(Model).GetHtml()

See Also

NumberFormat

Spin Editor

SpinEditProperties Class

SpinEditProperties Members

DevExpress.Web Namespace