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

RadNumericTextBox Hide Trailing Zeros

14 Answers 564 Views
Input
This is a migrated thread and some comments may be shown as answers.
Chen Jun Ying
Top achievements
Rank 1
Chen Jun Ying asked on 14 Feb 2012, 12:45 PM
Hi all,

I have  RadNumericTextBox with 10 DecimalDigits. I would like to hide any trailing zeros. If value is 0.1456000000, I want to display 0.1456.

Any ideas?
 


14 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 14 Feb 2012, 02:06 PM
Hello,

Try setting AllowRounding as false.

<telerik:RadNumericTextBox runat="server" ID="RadNumericTextBox">
   <NumberFormat AllowRounding="false" DecimalDigits="10" />
</telerik:RadNumericTextBox>

Thanks,
Princy.
0
Chen Jun Ying
Top achievements
Rank 1
answered on 15 Feb 2012, 01:45 PM
Thanks Princy.

It works on numerictextbox.

When I try the same on GridNumericColumn, it doesn't work.  Any ideas?
0
Vasil
Telerik team
answered on 15 Feb 2012, 02:07 PM
Hello,

This behavior is by design in the implementation of RadInput.
The feature request is logged in our private tracking system and we will try to implement it when done with the tasks that has higher priority.

Kind regards,
Vasil
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Chen Jun Ying
Top achievements
Rank 1
answered on 16 Feb 2012, 01:52 AM
Thanks Vasil.

I do not mean RadIput here.What I am after is to use GridNumericColumn to bind the data. I still shows all the trailing zeros even if I set AllowRounding="false" for the GridNumericColumn.

Chen.



0
Shinu
Top achievements
Rank 2
answered on 16 Feb 2012, 07:33 AM
Hello,
 
Try setting the DataFormatString.
aspx:
<telerik:GridNumericColumn DataField="Freight" HeaderText="Freight ID" DataFormatString="{0:f5}"   UniqueName="Freight" />

-Shinu.
0
Chen Jun Ying
Top achievements
Rank 1
answered on 16 Feb 2012, 10:16 AM
Hi Shinu,

It doesn't work. Since I don't know the number of decimal points, I can't set in the dataformatstring. Any ideas?

 
0
Vasil
Telerik team
answered on 16 Feb 2012, 12:49 PM
Hello,

Try to use the the {0:G} or {0:R} formats.

Greetings,
Vasil
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Chen Jun Ying
Top achievements
Rank 1
answered on 17 Feb 2012, 09:30 AM
Both DataFormatString are not working. Just wondering if it can be done using GridNumericColumn. I might consider using templatecolumn and format the number.
0
Vasil
Telerik team
answered on 21 Feb 2012, 04:22 PM
Hi Chen,

Yes if you like to perform any custom formatting you could always use a TemplateColumn that will give you more freedom and customization.

Greetings,
Vasil
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Chen Jun Ying
Top achievements
Rank 1
answered on 25 Feb 2012, 03:27 AM
Thanks Vasil.

i go for TemplateColumn option. 
0
Hitesh
Top achievements
Rank 1
answered on 23 Oct 2012, 03:24 PM
Hi,
I am using Telerik version 2012.2.912.40 and RadMaskedNumericInput.

It don't have NumberFormat AllowRounding="false" property.

Please advise how trailing zeros can be hidden on form as well in Grid?

Form
------------

 

 

 

 

<telerik:RadMaskedNumericInput Value="{Binding XXX, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" Mask="" FormatString="N4" TextMode="PlainText" IsClearButtonVisible="False" SelectionOnFocus="DefaultSelectAll" >

 

 

 

 

</CoreTelerikCtrl:RadMaskedNumericInput>

 

 

 

 


Grid
---------
<telerik:GridViewDataColumn.CellEditTemplate>

 

 

 

 

<DataTemplate>

 

 

 

 

<telerikInputCtrl:RadMaskedNumericInput Value="{Binding Path=XXX, Converter={StaticResource millionToNumberConverter}, UpdateSourceTrigger=PropertyChanged}"

 

 

 

 

telerikInputext:MaskedInputExtensions.Minimum="0"

 

 

 

Mask="" FormatString="N2" IsClearButtonVisible="False" />

 

 

 

 

</DataTemplate>

 

 

 

 

</telerik:GridViewDataColumn.CellEditTemplate>

 

0
Vasil
Telerik team
answered on 24 Oct 2012, 11:01 AM
Hello Hitesh,

The RadControls for ASP.Net Ajax does not contain control called "RadMaskedNumericInput". If you use the Silverlight suite, try to ask your question into their forums to get competent response from the Silverlight community.

Greetings,
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.
0
Jippy
Top achievements
Rank 1
answered on 26 Oct 2012, 12:29 PM
Hi,
   I have decimal values in telerik grid view data column, i formatted it and showing properly but when i try to edit the value and double click on it, it displays a bunch of zeros after the decimal point.Now i want to remove all those zeros when i double click for editing.Can anybody please help me out on this as soon as possible?
0
Vasil
Telerik team
answered on 26 Oct 2012, 02:42 PM
Hello Jippy,

Make sure KeepTrailingZerosOnFocus for your RadNumericTextBox is set to false (the default value).

Greetings,
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
Chen Jun Ying
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Chen Jun Ying
Top achievements
Rank 1
Vasil
Telerik team
Shinu
Top achievements
Rank 2
Hitesh
Top achievements
Rank 1
Jippy
Top achievements
Rank 1
Share this question
or