Allow numeric value to 3-digits right of decimal point.

2 Answers 81 Views
NumericTextBox
Ankit
Top achievements
Rank 1
Iron
Ankit asked on 19 Oct 2023, 09:59 AM

 

I am using below code and want to restrict input so user can only Allow numeric value to 3-digits right of decimal point.

for ex:

123.00

123

12.45

1

 <telerik:RadNumericTextBox ID="txtFactor" runat="server" MaxLength="5"
                                                MinValue="0.00" NumberFormat-DecimalDigits="<%$ Resources:Common,decimalDigitsTwo%>"
                                                Width="60px">
                                                 <ClientEvents OnBlur="CurrentYear" />
                                            </telerik:RadNumericTextBox>

2 Answers, 1 is accepted

Sort by
0
Ankit
Top achievements
Rank 1
Iron
answered on 19 Oct 2023, 11:33 AM
I can use regex ^(\d{0,3})(\.[0-9]{0,2})?$  but looking for any inbuild function .
0
Vasko
Telerik team
answered on 23 Oct 2023, 04:00 PM

Hello Ankit,

You can achieve the desired behavior by adjusting the NumberFormat-DecimalDigits property:

<telerik:RadNumericTextBox 
    ID="txtFactor" 
    runat="server" 
    MaxLength="5"
    Value="69"
    NumberFormat-DecimalDigits="2"> // Setting this will limit the numbers after the decimal point a user can insert (in this case 2)
</telerik:RadNumericTextBox>

For more information regarding, check the following links:

Kind regards,
Vasko
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources
Tags
NumericTextBox
Asked by
Ankit
Top achievements
Rank 1
Iron
Answers by
Ankit
Top achievements
Rank 1
Iron
Vasko
Telerik team
Share this question
or