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

Problem when trying to access a kendo multiselect object

1 Answer 32 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
Wayne
Top achievements
Rank 1
Wayne asked on 28 May 2015, 01:49 PM

Hi 

 

I wonder if anyone could help with an issue i am having with Kendo Multi-selection drop down lists.

i have a button which manually populates the field in the code, however when i try to access the object with jquery it results in the control making a copy of itself

 Many Thanks,

 

My MVC razor code

 <div class="col-md-2">
@Html.Kendo().MultiSelectFor(m => m.SelectedMeasuringPoints).BindTo(Model.MeasuringPoints.Select(x => x.TrimStart('0'))).Placeholder("Select points...").TagTemplate("0000#: data #").HtmlAttributes(new { @ID = "MPMultiSelection" })
</div> 

 

/My javascript

function selectDeselectAllMP() {

       //Get handle for the measuring point multi-selection
        var mpMultiselection = $('#MPMultiSelection').kendoMultiSelect().data("kendoMultiSelect");
    }

1 Answer, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 01 Jun 2015, 07:45 AM

Hello Wayne,

If you call your selectDeselectAllMP, function multiple times, then you will be initializing the widget multiple times which is not recommended/supported. If you want to get a reference of the widget you need to use the data() method directly on the jQuery element, without initializing it again.

Regards,
Kiril Nikolov
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
Wayne
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Share this question
or