For some reason I can use TextBoxFor in client template but cannot NumericTextBox
For ex. I have EditorTemplate
@Html.Kendo().TextBoxFor(m => m.Floor).HtmlAttributes(new { style = "width:100%;" }).ToClientTemplate()
Is absolutely fine
But
@Html.Kendo().NumericTextBoxFor(m => m.Sqm).HtmlAttributes(new { style = "width:100%;" }).ToClientTemplate()
generate "invalid template"
Here is what I extracted from error
<input data-val="true" data-val-number="The field Площадь must be a number." data-val-required="The Площадь field is required." id="Sqm" name="Sqm" style="width:100%;" type="number" value="" /><script>jQuery(function(){jQuery("#Sqm").kendoNumericTextBox({});});</script> </p>' Generated code:'var $kendoOutput, $kendoHtmlEncode = kendo.htmlEncode;with(data){$kendoOutput='<input data-val="true" data-val-required="The ApartmentId field is required." id="ApartmentId" name="ApartmentId" type="hidden" value="" /><div class="k-edit-label"> <label for="Number">Номер</label></div><div class="editor-field"> <input class="k-textbox" data-val="true" data-val-required="Укажите номер квартиры" id="Number" name="Number" style="width:100%;" value="" /></div><div class="k-edit-label"> <label for="Number">Подъезд</label></div><div class="editor-field"> <input class="k-textbox" id="Entrance" name="Entrance" style="width:100%;" value="" /></div><div class="k-edit-label"> <label for="Number">Этаж</label></div><div class="editor-field"> <input class="k-textbox" id="Floor" name="Floor" style="width:100%;" value="" /></div><div class="k-edit-label"> <label for="Number">Площадь</label></div><div class="editor-field"> <input class=\'numeric\' value=\'#=Sqm#\' name=\'Sqm\' /></div><p> <input data-val="true" data-val-number="The field Площадь must be a number." data-val-required="The Площадь field is required." id="Sqm" name="Sqm" style="width:100%;" type="number" value="" /><script>jQuery(function(){jQuery("';Sqm").kendoNumericTextBox({});});</script> </p>;$kendoOutput+=;}return $kendoOutput;
My property is of type double
now I had to workaround this by using input in clietntemplate
<input data-val="true" data-val-number="The field Площадь must be a number." data-val-required="The Площадь field is required." id="Sqm" name="Sqm" style="width:100%;" type="number" value="" />
and catch OnEdit event of Grid where I can enhance input like
jQuery(function(){jQuery("#Sqm").kendoNumericTextBox({});});
But I rather user @Html.Kendo().NumericTextBoxFor for my convinience