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

Need to remove the decimal points in the value.

4 Answers 1576 Views
NumericTextBox
This is a migrated thread and some comments may be shown as answers.
SAJID
Top achievements
Rank 1
SAJID asked on 21 May 2013, 03:47 PM
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.

4 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 23 May 2013, 01:05 PM
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!
0
Claudie
Top achievements
Rank 1
answered on 10 Dec 2014, 08:01 AM
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.
0
Georgi Krustev
Telerik team
answered on 12 Dec 2014, 08:15 AM
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!
 
0
Claudie
Top achievements
Rank 1
answered on 12 Dec 2014, 08:52 AM
Thank you Georgi,

It works fine.

Regards

Claudie
Tags
NumericTextBox
Asked by
SAJID
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Claudie
Top achievements
Rank 1
Georgi Krustev
Telerik team
Share this question
or