Igor Malkevich
Igor Malkevich

Reputation: 21

kendo numerictextbox in clienttemplate - issue with dot in name

I am doing following in kendo grid:

columns.Bound(x => x.Item.Equity)
    .Format("{0:f2}")
    .Width(100)
    .HeaderTemplate("Equity<br/>Meta")
    .ClientTemplate(Html.Kendo().NumericTextBox()
        .Name("mp_#=Item.Id#")
        .Min(0)
        .HtmlAttributes(new { value = "#=Item.Equity#" })
        .ToClientTemplate()
        .ToHtmlString());

and get this client template for NumericTextBox:

<input class="k-input" id="mp_#=Item.Id#" min="0" name="mp_#=Item.Id#" type="number" value="#=Item.Equity#" /><script>
    jQuery(function(){jQuery("\#mp_#=Item\\.Id#").kendoNumericTextBox({});});
<\/script>

Then I have in console: Error: Invalid template

I think that the problem is in

jQuery("\#mp_#=Item\\.Id#").kendoNumericTextBox({});

because of Item\.Id

Please, can somebody help me to solve the issue with assigning proper name to numerictextbox.

Upvotes: 1

Views: 2324

Answers (1)

Trey Gramann
Trey Gramann

Reputation: 2004

I have not seen it done like this. Usually the ClientTemplate is a string of the id of a script block.

This might help: Can a Kendo Grid Column's ClientTemplate to another kendo object like a ListView?

Upvotes: 0

Related Questions