This is a migrated thread and some comments may be shown as answers.

Allow only 2 digits are decimal in RadNUmericTextbox

1 Answer 514 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Atchut
Top achievements
Rank 1
Atchut asked on 29 May 2012, 09:55 PM
Hello,

I am having a RadNumeric textbox to enter only numbers. I dont want allow user to enter more than 2 digits after decimal.

Here is my code. It is allowing more than 2 digits after decimal but it is rounding off to 2 digits after coming out of textbox.

I dont want user to allow more than 2 right away.
 <telerik:RadNumericTextBox  ID="txtNewPrice" runat="server" MaxLength="10"  AutoCompleteType="None"  MinValue="0" CssClass="txtException"
                            Width="50px"  Type="Number" ShowSpinButtons="false" AllowOutOfRangeAutoCorrect="false" InvalidStyle-Font-Bold="true">
                       <NumberFormat AllowRounding="false" DecimalDigits="2"  KeepNotRoundedValue="true" GroupSizes="3"/>
                  
                     </telerik:RadNumericTextBox>

1 Answer, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 30 May 2012, 10:38 PM
Atchut,

If you've not already seen this forum thread, I'd suggest that you reference the solution provided by Telerik Admin-Dimo on January 22, 2010:

RadTextbox Decimal Places

"There is no native way to prevent users from entering more than X decimal numbers. However, you can subscribe to the KeyPress client event and cancel it if a specific number of decimal places has been reached...." (code sample provided in that thread)

Hope this helps!
Tags
Grid
Asked by
Atchut
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or