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

Copy one multiselect values to another multiselect

6 Answers 236 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
crazy05
Top achievements
Rank 1
crazy05 asked on 18 Oct 2014, 02:03 PM
Hi,

I have one multiselect in cshtml page. When I click on button in cshtml page, I am showing Kendo Window. In kendo window, there is one more multi select and OK, Cancel buttons.

If user clicks on OK, I am calling controller and passing values of multiselect and doing the required operation.

I want to display the same values in multiselect in cshtml page. How can I do this ? Here is my code.

$("#okay").kendoButton({
            click: function () {               
                var rowID = $("#selectedValues").val();
                data = { 'rows': rowID };               
                $.ajax({
                    type: "POST",
                    url: "Rows" + window.location.search,
                    data: data,
                    traditional: true,
                    dataType: "json",
                    success: function (result) {                       
                        $("#Dialog").data("kendoWindow").close();
                        return true;
                    },
                    error: function () {
                        alert("An Error Occured. Please Cancel and Try Again!");
                        return false;
                    }
                });
            }
        });

6 Answers, 1 is accepted

Sort by
0
crazy05
Top achievements
Rank 1
answered on 19 Oct 2014, 12:33 PM
Hi,

On document.ready function, multiselect in main cshtml page is null. I am not binding any datasource.

How can I do this ?
0
crazy05
Top achievements
Rank 1
answered on 20 Oct 2014, 12:39 PM
Any help ?
0
crazy05
Top achievements
Rank 1
answered on 21 Oct 2014, 01:12 PM
var multiselect = $("#multiselect1").data("kendoMultiSelect");
 $("#multiselect2").data("kendoMultiSelect").setDataSource(multiselect.dataSource);
0
Vladimir Iliev
Telerik team
answered on 22 Oct 2014, 06:22 AM
Hi Ram,

You can use the MultiSelect and it's DataSource API to get the value from the second widget and set it as value to the first MultiSelect inside the "success" event handler of the custom "ajax" request. For convenience I created small demo of copying values and dataSource from one MultiSelect to another which you can use as baseline to achieve the desired behavior:


Regards,
Vladimir Iliev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
crazy05
Top achievements
Rank 1
answered on 22 Oct 2014, 12:54 PM
H[quote]Vladimir Iliev said:
Copy values from one MultiSelect to another

[/quote]

This code snippet is not loading.
0
Vladimir Iliev
Telerik team
answered on 23 Oct 2014, 07:17 AM
Hi Ram,

The previous example is accessible on our side, however for your convenience I uploaded the example to jsBin as well:

Regards,
Vladimir Iliev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
MultiSelect
Asked by
crazy05
Top achievements
Rank 1
Answers by
crazy05
Top achievements
Rank 1
Vladimir Iliev
Telerik team
Share this question
or