
$(".txtPct").kendoNumericTextBox({
format: "p0",
min: 0,
max: 100,
step: 1
});
Any help would be appreciated. Also, any plans to update the documentation? There seems to be a lot of stuff that needs to be "discovered" by the developer at this point. Thanks!
4 Answers, 1 is accepted
You can use the decimals option when initialize the widget. Check the Configuration/decimals section.
Georgi Krustev
the Telerik team
$(".txtPct").kendoNumericTextBox({
format: "p0",
min: 0,
max: 100,
step:1,
value:25,
decimals:0
});
It will give me "2,500%" in the textbox?? So 100x what I want. Can it only use step decimals in percentages? I also tried other formats like "n%", "0%", but none of those worked,
By design when "p" or "%" is used in the format, the value is multiplied by 100. Currently excaping the "%" symbol or using literals in the format is not supported. It is in our ToDo list, but I will not be able to give a specific time frame for the implementation.
Georgi Krustev
the Telerik team
Where I can find all allowed values for format parameter?
Thanks
Serge
Currently, the supported formats are not clearly documented. We are working on this and soon we will update the docs for the globalization. We have used these specifications for implementing the number formatting -
http://msdn.microsoft.com/en-us/library/dwhawy9k(v=vs.71).aspx
http://msdn.microsoft.com/en-us/library/0c899ak8.aspx
Georgi Krustev
the Telerik team
Thanks,
Ned
You need to make the "%" symbol a literal in order to avoid default behavior. Check this jsBin demo.
Georgi Krustev
the Telerik team
Thanks,
Ned
Currently escaping the percent sign is not supported. I will add your feature request to our internal system for further investigation and consideration. If other users need this functionality we will schedule it for development.
Georgi Krustev
the Telerik team
After further investigation, we decided to implement the required functionality. It is available in the last internal build (2012.2.823).
Georgi Krustev
the Telerik team
Yuo can escape the "%" sign like this:
"# \\%"
Regards, Georgi Krustev
the Telerik team
I am trying to make it just display an int, but I always get 1.00
Tried format: 'g', and format: 'G', but no luck there
I just want to display the percent sign and i don't want the value multiplied by 100. Any suggestions? Thanks.
And why is the documentation still not complete?
I'm having the same stupid issue. I'm not sure why anyone would want a user to enter a percentage as fractions?
I'm doing this with a kendo Grid and MVVM binding. The grid's row template looks as follows (ignore zzz - just hiding business specific stuff):
<
script
id
=
"row-template"
type
=
"text/x-kendo-template"
>
<
tr
>
<
td
></
td
>
<
td
data-bind
=
"text: zzz"
>
</
td
>
<
td
data-bind
=
"text: zzz"
>
</
td
>
<
td
>
<
input
data-role
=
"dropdownlist"
data-text-field
=
"zzz"
data-value-field
=
"zzz"
data-bind
=
"{source: zzz, events: {change: zzz, dataBound: zzz}}"
data-value-primitive
=
"true"
/>
</
td
>
<
td
class
=
"text-right"
>
<
input
class
=
"editable"
data-role
=
"numerictextbox"
data-format
=
"P0
data-bind
=
"{value: zzz}"
data-min
=
"0"
data-max
=
"100"
/>%
</
td
>
<
td
class
=
"text-right"
>
#: zzz #
</
td
>
<
td
class
=
"text-right"
>
#: zzz #
</
td
>
<
td
class
=
"text-right"
>
#: zzz #
</
td
>
<
td
class
=
"text-right"
>
#: zzz #
</
td
>
</
tr
>
</
script
>
I replaced the format with "# \\%"
The result is an exception: "Invalid template"
If I replace "# \\%" with "# %' it still throws the same exception.
Escaping the # as in "\\# \\%" works.
Hope this helps someone.
The Premium forums were introduced after the last post in this forum thread. Before that the forums were supported by the community itself and we did not guarantee any response, although, we tried to answer to all threads.
The percent format "p" by design multiplies the number by 100. I will suggest you check our documentation about the supported formats. Also you can examine the MSDN numeric format documentation, which is very explanatory.
The Kendo Templates uses "#" as part of its binding expression and if you have "#" symbol you will need to escape it. As you pointed in this case the correct format is "\\# \\%".
Regards,
Georgi Krustev
Telerik

format: "#"
@(Html.Kendo().NumericTextBoxFor(m => m.MaximumFileCount)
.Min(0)
.Max(100)
.Decimals(0)
.Format(
"#"
))

template: '#=kendo.format("{0:p}", value/ 100)#'
Replace value with field/column name.