This is a migrated thread and some comments may be shown as answers.

frontend a duplicate multiselect element is created.

1 Answer 350 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
Sanjay
Top achievements
Rank 1
Sanjay asked on 11 Apr 2014, 02:08 AM
Hi

I have defined a multiselect element in my page. The I am trying to get the value of select items using javascript. When the .Value line is executed on the frontend a duplicate element is created.

The pre and post image is attached.

Please help

Regards,
Sanjay
Definition
@(Html.Kendo().MultiSelectFor(m => m.SeleFromAvail)                           
    .Name("seleLst")
       .Placeholder("Select")
       .HtmlAttributes(new { id = "seleLst", style = "width:940px;" })                           
       .BindTo((List<SelectListItem>)ViewBag.lstAvail)
       .Value((List<SelectListItem>)ViewBag.lstSele)
       .AutoClose(false)
       )
Javascript       
param = $("# seleLst ").kendoMultiSelect().data("kendoMultiSelect").value();

1 Answer, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 11 Apr 2014, 07:45 AM
Hello Sanjay,

The widget is rendered twice, because the JavaScript code from your code snippet actually initialize the rendered widget for second time. If you need to retrieve the client instance of the widget then you will need to use this:
param = $("# seleLst ").data("kendoMultiSelect").value();
Find more information about how to retrieve the client instance here.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
MultiSelect
Asked by
Sanjay
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or