This is a migrated thread and some comments may be shown as answers.
KeepTrailingZerosOnFocus NumericTextBox
4 Answers 29 Views
This is a migrated thread and some comments may be shown as answers.
Jocelyn
Top achievements
Rank 1
Jocelyn asked on 24 Feb 2012, 04:29 PM
I want the same property behavious set to false but On NOT Focus. If I have 100 it will show 100.00 on no focus and 100 on focus... I want 100 on both. Is that possible? But I want to show the 2 digits if it's not .00

Thanks

4 Answers, 1 is accepted

Sort by
0
Jocelyn
Top achievements
Rank 1
answered on 27 Feb 2012, 03:33 PM
Nobody can help me?
0
Richard
Top achievements
Rank 1
answered on 27 Feb 2012, 09:36 PM
Jocelyn:

Take a look at this forum thread which covers your issue in depth: Feature Request : Numeric Textbox & Trailing Zeros.

If I understand your requirement, you should be able to use the "NumericTextBox1.NumberFormat.DecimalDigits = 0;" setting to trim the trailing "0"s. See Formatting Numeric Values

Hope this helps!
0
Jocelyn
Top achievements
Rank 1
answered on 02 Mar 2012, 09:42 PM
I tried what the guy said. It is not working for me.

When I try this is debug:

function PoidsTaille_OnValueChanged(sender, eventArgs)
{
    var v = eventArgs.get_newValue().toString();
    sender._textBoxElement.value = v;
    PoidsTaille_Changed(sender._clientID, eventArgs.get_newValue());
}

It removes the trailling zeros, but when this function is done, the trailling zeros come back... In debug, zeros come back when this.updateDisplayValue()  is called.
0
Vasil
Telerik team
answered on 05 Mar 2012, 01:33 PM
Hi Jocelyn,

You could override the get_displayValue function that is used for generating the display value and apply your custom format instead of using these from the Telerik.Web.UI.NumberFormat.
Here is an example:
<script type="text/javascript">
   Telerik.Web.UI.RadNumericTextBox.prototype.get_displayValue = function ()
   {
     var value = this.get_value();
     return value.toString(); //or apply your custom format here
   }
 </script>
 <telerik:RadNumericTextBox runat="server">
 </telerik:RadNumericTextBox>


Kind regards,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Input
Asked by
Jocelyn
Top achievements
Rank 1
Answers by
Jocelyn
Top achievements
Rank 1
Richard
Top achievements
Rank 1
Vasil
Telerik team
Share this question
or