1
votes

I am using the kendo multiselect control and I set its value using Jquery. Once I add a kendo window to my form, the Jquery code can't find the multiselect control and it gives an error "Cannot set value of undefined".

<div id="dialog"> @(Html.Kendo().Window() .Name("ActionItemWindow").Title("Add New Author").Visible(false).Modal(true).Width(1000).Draggable(true).Actions(actions => actions.Maximize().Close()).LoadContentFrom("/Author/_AddNewAuthor"))</div>

@(Html.Kendo().MultiSelect().Name("authorsmultiselect").Placeholder("Select author..").MinLength(4).DataSource(source =>{source.Read(read => { read.Action("GetAuthorsList", "Author"); }).ServerFiltering(false);}).DataTextField("Email").DataValueField("ID"))<input id="Button1" type="button" onclick="showActionItemDetails();" value="button" />

<script>function showActionItemDetails() {var multiselect = $("#authorsmultiselect").data("kendoMultiSelect");multiselect.value("1");}</script>
1
Please can you provide the code for your jQuery and multiselect control so we can see where the issue may lie? - Stu1986C
You should post more code so we can see exactly how you are using the Kendo Window with your form. In the meantime, take a look at this link on "Using Kendo UI Window with a form": docs.telerik.com/kendo-ui/getting-started/web/window/… - Kevin Babcock
Are you say that this line of code @(Html.Kendo().Window() .Name("ActionItemWindow").Title("Add New Author").Visible(false).Modal(true).Width(1000).Draggable(true).Actions(actions => actions.Maximize().Close()).LoadContentFrom("/Author/_AddNewAuthor")) breaks your page? Meaning that if you remove the selected line of code, the page works as intended? - ChampChris

1 Answers

0
votes

You need to put the multiselect control code and the code that sets its value in the section (partial view?) where the content is loaded (e.g. /Author/_AddNewAuthor).