RadNumericTextBox
RadNumericTextBox restricts user input to numeric values. It shares the common properties of all RadInput controls, including support for skins, styles for different states, empty message support, conditional postback on text change, flexible caret and button positioning, labels, and so on.
You can find information on the server API of RadNumericTextBox at .
Definition
Namespace:Telerik.Web.UI
Assembly:Telerik.Web.UI.dll
Syntax:
[ClientScriptResource("Telerik.Web.UI.RadNumericTextBox", "Telerik.Web.UI.Input.NumericTextBox.RadNumericInputScript.js")]
[RequiredScript(typeof(RadTextBox))]
[ValidationProperty("ValidationText")]
[ControlValueProperty("Text")]
[ToolboxBitmap(typeof(RadNumericTextBox), "Toolbox.Icons.NumericTextbox.png")]
[TelerikToolboxCategory("Data Editing")]
[RequiredCss("Telerik.Web.UI.Skins.Common.fonticons.css", RenderMode.Lightweight, typeof(RadNumericTextBox))]
public class RadNumericTextBox : RadInputControl, IComponent, IDisposable, IParserAccessor, IUrlResolutionService, IDataBindingsAccessor, IControlBuilderAccessor, IControlDesignerAccessor, IExpressionsAccessor, IAttributeAccessor, IScriptControl, IControlResolver, IPostBackDataHandler, ISkinnableControl, IControl, IPostBackEventHandler, INamingContainer, IEditableTextControl, ITextControl, IRadNumericTextBox
Inheritance: objectControlWebControlRadWebControlRadInputControlRadNumericTextBox...
Implements:
Inherited Members
Constructors
public RadNumericTextBox()
Properties
Gets or sets whether the RadNumericTextBox should autocorrect out of range values to valid values or leave them visible to the user and apply its InvalidStyle. If the InvalidStyle is applied, the control will have no value.
public bool AllowOutOfRangeAutoCorrect { get; set; }
The default value is true
Gets control that contains the up button of RadInput control
[Browsable(false)]
public virtual HtmlGenericControl ButtonDownContainer { get; }
The ShowButton or ShowSpinButton properties must be set to true
Gets control that contains the up button of RadInput control
[Browsable(false)]
public virtual HtmlGenericControl ButtonUpContainer { get; }
The ShowButton or ShowSpinButton properties must be set to true
Gets or sets the culture used by RadNumericTextBox to format the numburs.
[Browsable(true)]
public CultureInfo Culture { get; set; }
A CultureInfo object that represents the current culture used. The default value is System.Threading.Thread.CurrentThread.CurrentUICulture.
Implements:
Type of object that is used to wrap the DbValue property.
[TypeConverter("Telerik.Web.UI.NumericDataTypeConverter, Telerik.Web.Design, Version=2026.3.812.462, Culture=neutral, PublicKeyToken=121fae78165ba3d4")]
public Type DataType { get; set; }
Default value is set to the Double.
That property is designed to be used when this control is embedded into grid or other data-bound control.
Default value is set to the Double.
Gets or sets the date content of RadNumericTextBox in a database friendly way.
[SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
[Bindable(true, BindingDirection.TwoWay)]
[Browsable(true)]
public virtual object DbValue { get; set; }
An object that represents the Text property. The default value is null.
This property behaves exactly like the Value property. The only difference is that it will not throw an exception if the new value is not double object (or null). If you assign null to the control you will see blank RadInput.
Gets or sets a value indicating the Multiplication factor used in DbValue property.
public virtual double DbValueFactor { get; set; }
1.0 by default. It can be set to anything different than zero.
Use this property when you want to multiply value bound from the database by some factor, and then to devide by the same factor when saving it back to the database.
Gets or sets the display text which allows you to set the display value from the Server to a different value the actual value. Similar to the empty message, but shown even if the input is not empty. This text will be cleared once the user changes the input value.
public override string DisplayText { get; set; }
The display text which allows you to set the display value from the Server to a different value the actual value. Similar to the empty message, but shown even if the input is not empty. This text will be cleared once the user changes the input value.
Overrides:
Gets or sets a value indicating whether to add a pattern attribute to the input element for triggering numeric keyboards on mobile devices.
public bool EnableMobilePattern { get; set; }
true if the pattern attribute should be added to enable numeric keyboard on mobile devices; otherwise, false. The default value is false.
When set to
true, the control will add a pattern="[0-9]*" attribute to the input element, which triggers the numeric keyboard on mobile devices. This is useful for improving the user experience on mobile devices by showing a numeric keyboard instead of the full keyboard.
Gets the settings associated with RadNumericTextBox increment settings determining the behavior when using the mouse wheel and keyboard arrow keys.
[PersistenceMode(PersistenceMode.InnerProperty)]
public InputIncrementSettings IncrementSettings { get; }
The settings associated with RadNumericTextBox increment settings determining the behavior when using the mouse wheel and keyboard arrow keys.
Gets or sets the largest possible value of a RadNumericTextBox.
[ClientControlProperty]
public virtual double MaxValue { get; set; }
The default value is positive 2^46.
Gets or sets the smallest possible value of a RadNumericTextBox.
[ClientControlProperty]
public virtual double MinValue { get; set; }
The default value is negative -2^46.
Gets the style properties for RadInput when when the text is negative.
[PersistenceMode(PersistenceMode.InnerProperty)]
public InputStyle NegativeStyle { get; }
A Telerik.WebControls.TextBoxStyle object that represents the style properties for RadInput control. The default value is an empty TextBoxStyle object.
Use this property to provide a custom style for the negative state of RadInput control. Common style attributes that can be adjusted include foreground color, background color, font, and alignment within the RadInput. Providing a different style enhances the appearance of the RadInput control.
Negative style properties in the RadInput control are inherited from one style property to another through a hierarchy. For example, if you specify a red font for the EnabledStyle property, all other style properties in the RadInput control will also have a red font. This allows you to provide a common appearance for the control by setting a single style property. You can override the inherited style settings for an item style property that is higher in the hierarchy by setting its style properties. For example, you can specify a blue font for the NegativeStyle property, overriding the red font specified in the EnabledStyle property.
To specify a custom style, place the <NegativeStyle> tags between the opening and closing tags of the RadInput control. You can then list the style attributes within the opening <NegativeStyle> tag.
Gets the numeric format of the RadNumericTextBox control.
[PersistenceMode(PersistenceMode.InnerProperty)]
public NumberFormatSettings NumberFormat { get; }
The numeric format of the RadNumericTextBox control.
Gets or sets the selection on focus options for the RadInput control
[ClientControlProperty]
[Themeable(true)]
public override SelectionOnFocus SelectionOnFocus { get; set; }
A Telerik.WebControls.SelectionOnFocus object that represents the selection on focus in RadInput control. The default value is "None".
- None
- CaretToBeginning
- CaretToEnd
- SelectAll
Overrides:
Use this property to provide selection on focus of RadInput control. You can set one of the following values:
Gets or sets a value indicating whether the button is displayed in the RadInput control.
[ClientControlProperty]
public virtual bool ShowSpinButtons { get; set; }
true if the button is displayed; otherwise, false. The default value is true, however this property is only examined when the ButtonTemplate property is not a null reference (Nothing in Visual Basic).
Use the ShowButton property to specify whether the button is displayed in the RadInput control.
The contents of the button are controlled by the ButtonTemplate property.
public virtual string SmartPasteDescription { get; set; }
Gets or sets CSS class for the spin down button.
public virtual string SpinDownCssClass { get; set; }
The CSS class for the spin down button.
Gets or sets CSS class for the spin up button.
public virtual string SpinUpCssClass { get; set; }
The CSS class for the spin up button.
protected override HtmlTextWriterTag TagKey { get; }
Overrides:
Gets or sets the text content of a control.
[Browsable(false)]
[Bindable(false)]
public override string Text { get; set; }
The text content of a control.
Overrides:
Gets or sets the numeric type of the RadNumericTextBox.
public virtual NumericType Type { get; set; }
One of the NumericType enumeration values. The default is Number.
Implements:
Use the Type property to determine the numeric type that the RadNumericTextBox represents. The Type property is represented by one of the NumericType enumeration values.
Gets the validation text which is used when validation of the RadInputControl fails.
public override string ValidationText { get; }
The validation text which is used when validation of the RadInputControl fails.
Overrides:
Gets or sets the value of the RadInput control.
[Browsable(true)]
[Bindable(true, BindingDirection.TwoWay)]
public virtual double? Value { get; set; }
null if the Text property is Empty.The Value property are Nullable Double type. A nullable type can represent the normal range of values for its underlying value type, plus an additional null value. For example, a Nullable<Double>, pronounced "Nullable of Double," can be assigned any value from -2^46 (-70368744177664) to 2^46 (70368744177664), or it can be assigned the null value.
Use the Text property to specify or determine the text displayed in the RadInput control. To limit the number of characters accepted by the control, set the MaxLength property. If you want to prevent the text from being modified, set the ReadOnly property.
The value of this property, when set, can be saved automatically to a resource file by using a designer tool.
Methods
protected override void AddAttributesToRender(HtmlTextWriter writer)
Overrides:
protected override void CreateChildControls()
Overrides:
protected override void DescribeClientEvents(IScriptDescriptor descriptor)
Overrides:
protected override void DescribeClientProperties(IScriptDescriptor descriptor)
Overrides:
protected override void DescribeComponent(IScriptDescriptor descriptor)
Overrides:
Loads the client state data
protected override void LoadClientState(Dictionary<string, object> clientState)
Overrides:
Executed when post data is loaded from the request
protected override bool LoadPostData(string postDataKey, NameValueCollection postCollection)
Overrides:
protected override void MergeAuxiliaryStyles()
Overrides:
protected override void RenderChildren(HtmlTextWriter writer)
Overrides:
protected override void SetDesignTimeAttributes(HtmlTextWriter writer)
Overrides:
protected override void SetStyleClasses()
Overrides:
protected override void TrackViewState()
Overrides: