Need to remove the decimal points in the value.

5 posts, 0 answers
  1. SAJID
    SAJID avatar
    10 posts
    Member since:
    Oct 2012

    Posted 21 May 2013 Link to this post

    Hi,

    I have a Kendo NumericTextBox which displays the percentage value. I need to display "10" and not "10.00" if the input is "10". Below is my code and i used Format(P0). but when user tries to input the value it accepts in the format like 0.01 for 1%.

    @(Html.Kendo().NumericTextBox<int>()
                 .Name("FlexUp")
                 .Format("#")
                .Min(0)
                .Max(100)
                .Step(1) 
                .Decimals(0) 

    Thanks for the help in advance.
  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 23 May 2013 Link to this post

    Hello Sajid,

    The behaviour which you described is expected - if the format is set to "p" the entered number will be multiplied by 100 (docs).

    To display "10 %" when the user input is "10", please use the following configuration:
    @(Html.Kendo().NumericTextBox<int>()
        .Name("FlexUp")
        .Format("# \\%")
        .Min(0)
        .Max(100)
        .Step(1)
        .Decimals(0)


    Regards,
    Alexander Valchev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Claudie
    Claudie avatar
    2 posts
    Member since:
    Jul 2014

    Posted 10 Dec 2014 Link to this post

    Hello Alexander,

    I try this and it works when my NumericTextBox is on editing mode "3". But for display the value, i still show the comma "3.00".

    I'd like to remove the decimal points in the value all the time.

    Here, the code i try :
                     @(Html.Kendo().NumericTextBox()
                     .Name("NombreMoisPeriode")
                     .Min(0)
                     .Decimals(0)
                     .Format("# \\"))

    or 
                     .Format("#"))
    or 
                     .Format("c"))

    witout any success

    Thanks for the help in advance.
  5. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 12 Dec 2014 Link to this post

    Hello Claudie,

    The correct setup is the one you've posted in your first post. I prepared a simple demo that shows the correct behavior of the widget. I also took a screencast of its work.
    Let me know if I am missing something.

    Regards,
    Georgi Krustev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  6. Claudie
    Claudie avatar
    2 posts
    Member since:
    Jul 2014

    Posted 12 Dec 2014 in reply to Georgi Krustev Link to this post

    Thank you Georgi,

    It works fine.

    Regards

    Claudie
Back to Top
Kendo UI is VS 2017 Ready