I have some model with selected ids:
class Model{ public IList<int> SelectedIds { get; set; }}in my partial view I render Multiselect control:
@(Html.Kendo().MultiSelectFor(f => f.SelectedIds) .Name("SelectedIds") .Placeholder("Select Items...") .Filter(FilterType.Contains) .IgnoreCase(true).TagMode(TagMode.Single) .TagTemplate("<span>Selected #=data.dataItems.length# from #=data.maxTotal#</span>") .DataSource(a => a.Read("GetItemsListAction", "Controller")) .DataValueField("Id") .DataTextField("Value") .AutoClose(false))and it renders next wrong Javascript code (see value of the "value" at the end of the expression :):
jQuery(function(){jQuery("#SelectedIds").kendoMultiSelect({"dataSource":{"transport":{"read":{"url":"/sspd/Controller/GetItemsListAction"},"prefix":""},"schema":{"errors":"Errors"}},"dataTextField":"Value","filter":"contains","ignoreCase":true,"tagMode":"single","tagTemplate":"\u003cspan\u003eSelected#=data.dataItems.length# from #=data.maxTotal#\u003c/span\u003e","autoClose":false,"dataValueField":"Id","placeholder":"Select Items...","value":["System.Collections.Generic.List`1[System.Int32]"]});});BUT!
When I change the Name in Razor code to something other name, for example, "bla-bla-bla" it renders correct code and I see in the web page multiselect with selected items:
jQuery(function(){jQuery("#bla-bla-bla").kendoMultiSelect({"dataSource":{"transport":{"read":{"url":"/sspd/Controller/GetItemsListAction"},"prefix":""},"schema":{"errors":"Errors"}},"dataTextField":"Value","filter":"contains","ignoreCase":true,"tagMode":"single","tagTemplate":"\u003cspan\u003eSelected#=data.dataItems.length# from #=data.maxTotal#\u003c/span\u003e","autoClose":false,"dataValueField":"Id","placeholder":"Select Items...","value":[28620,32216]});});In other words, rendered javascript is incorrect when Model's property for the selected ids is the same with parameter value passed to Html.Kendo().MultiSelect().Name method
Whats wrong in my code?