2

I have a RadNumericTextBox as below:

  <telerik:RadNumericTextBox ID="txtCurSalBudget" runat="server" Enabled="False" >
                <NumberFormat AllowRounding="false" />
                </telerik:RadNumericTextBox>

When I move a value 23190642.0 to this textbox,it gets rounded and result is 23190640,even though AllowRounding="false".

How to avoid this rounding,so that I will get the actual value?

Jeff Fritz
  • 9,821
  • 7
  • 42
  • 52
Soumya
  • 123
  • 2
  • 10
  • 21
  • Why do you have `Enabled="False"` specified? Are you enabling the control at run-time? Am I correct that you want to maintain the precision specified by including the zero? – Jeff Fritz Dec 06 '12 at 12:20

2 Answers2

2

Use this code to display decimal digits in your textbox:

<telerik:RadNumericTextBox ID="txtCurSalBudget" runat="server" Enabled="False" >
                <NumberFormat AllowRounding="false" DecimalDigits="2" GroupSeparator=" " />
</telerik:RadNumericTextBox>

The property

DecimalDigits

allows decimal digits up to the number you enter, to be displayed in your textbox.

Aakarsh
  • 21
  • 2
1

If you always want to always maintain a single decimal place of precision, you can change your NumberFormat element to reflect this:

    <telerik:RadNumericTextBox ID="RadNumericTextBox1" 
                               runat="server" 
                               Culture="en-US">
        <NumberFormat AllowRounding="false" 
                      PositivePattern="n.0" 
                      NumericPlaceHolder="n" />
    </telerik:RadNumericTextBox>

Does this sample NumericTextBox meet your needs?

Jeff Fritz
  • 9,821
  • 7
  • 42
  • 52
  • 1
    I was moving a float value to the radnumeric textbox.Since the float has precision of only 7 digits,i was getting 23190640 instead of 23190642 in radnumeric textbox.I have changed float to decimal and it works fine. – Soumya Dec 07 '12 at 06:14