Вопрос

For some reason my numericTextbox is still showing a decimal and numbers after the decimal while in a kendo template. I followed the other answers by having the attributes of decimals="0" and format="#" but to no avail.

code:

<table>
            <tbody>
                # for (var i = 0; i < data.length; i++) { #
                    <tr>                    
                        <td>
                            <input type="number" data-role="numerictextbox" value="#= data[i].Copies #" 
                                decimals="0" format="\\#" min="1" class="copies" style="width:60px;"/>
                        </td>
                    </tr>
                # } #
            </tbody>
        </table>
Это было полезно?

Решение 2

When using declarative binding with Kendo UI, you must precede widget properties with data-. That's why decimals="0" and format="\\#" do nothing. Instead, write them as data-decimals="0" or data-format="\\#".

Другие советы

Just use the following code:

@(Html.Kendo().NumericTextBox<int>()
.Name("Id") 
.Value(0)
.Decimals(0)
.Format("#"))

The above solution didn't work for me. I found below solution which worked for me. May be below solution will be useful for others. You just need to set decimals:0 and format:'#'.

$('input').kendoNumericTextBox({
                step: 1000,
                min:1,
                value:200,
                decimals:0,
                format:'#'
            });

Reference : https://www.telerik.com/forums/need-to-remove-the-decimal-points-in-the-value-#2633984

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top