RadNumericTextBox Hide Trailing Zeros

15 posts, 0 answers
  1. Chen Jun Ying
    Chen Jun Ying avatar
    22 posts
    Member since:
    Apr 2010

    Posted 14 Feb 2012 Link to this post

    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?
     


  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 14 Feb 2012 Link to this post

    Hello,

    Try setting AllowRounding as false.

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

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Chen Jun Ying
    Chen Jun Ying avatar
    22 posts
    Member since:
    Apr 2010

    Posted 15 Feb 2012 Link to this post

    Thanks Princy.

    It works on numerictextbox.

    When I try the same on GridNumericColumn, it doesn't work.  Any ideas?
  5. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 15 Feb 2012 Link to this post

    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 >>
  6. Chen Jun Ying
    Chen Jun Ying avatar
    22 posts
    Member since:
    Apr 2010

    Posted 15 Feb 2012 Link to this post

    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.



  7. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 16 Feb 2012 Link to this post

    Hello,
     
    Try setting the DataFormatString.
    aspx:
    <telerik:GridNumericColumn DataField="Freight" HeaderText="Freight ID" DataFormatString="{0:f5}"   UniqueName="Freight" />

    -Shinu.
  8. Chen Jun Ying
    Chen Jun Ying avatar
    22 posts
    Member since:
    Apr 2010

    Posted 16 Feb 2012 Link to this post

    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?

     
  9. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 16 Feb 2012 Link to this post

    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 >>
  10. Chen Jun Ying
    Chen Jun Ying avatar
    22 posts
    Member since:
    Apr 2010

    Posted 17 Feb 2012 Link to this post

    Both DataFormatString are not working. Just wondering if it can be done using GridNumericColumn. I might consider using templatecolumn and format the number.
  11. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 21 Feb 2012 Link to this post

    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 >>
  12. Chen Jun Ying
    Chen Jun Ying avatar
    22 posts
    Member since:
    Apr 2010

    Posted 24 Feb 2012 Link to this post

    Thanks Vasil.

    i go for TemplateColumn option. 
  13. Hitesh
    Hitesh avatar
    16 posts
    Member since:
    Jul 2012

    Posted 23 Oct 2012 Link to this post

    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>

     

  14. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 24 Oct 2012 Link to this post

    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.
  15. Jippy
    Jippy avatar
    5 posts
    Member since:
    Oct 2012

    Posted 26 Oct 2012 Link to this post

    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?
  16. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 26 Oct 2012 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017