Adding a % sign to a percentage in Kendo NumericTextBox

MonOve picture MonOve · Jan 2, 2013 · Viewed 8.1k times · Source

Trying to add a % sign to a number in a Kendo NumericTextBox. They suggest escaping the % sign as such:

$("#numeric").kendoNumericTextBox({
    format: "# \%"
});

but when I give it a value of 3, it still gives me 300%!

From the Kendo documentation:

"%" - percentage placeholder Multiplies a number by 100 and inserts a localized percentage symbol in the result string. Note: '%' symbol is interpreted as a format specifier in the format string. If you need to prevent this, you will need to precede the '%' symbol with a backslash - 'kendo.toString(12, "# \%")' -> 12 % (en-us).

Answer

Joost Pielage picture Joost Pielage · May 6, 2015

I was working in a column of a grid in a .cshtml file and for me the following is working:

  Format("{0:#.## \\'%'}");

notice the two single quotes arround the % sign.