Johny Bravo
asked on
Kendo UI multiselect Asp.Net
Hello Experts,
I am new to Kendo UI. I want to bind the Multiselect control from my sql table.
I am new to Kendo UI. I want to bind the Multiselect control from my sql table.
<div class="demo-section">
<h2>
Invite Attendees</h2>
<label for="required">
Required</label>
<select id="required" multiple="multiple" data-placeholder="Select attendees..." class="mySelect">
</select>
<button class="k-button" id="get">Send Invitation</button>
</div>
$.ajax({
// the url to the service
url: "api/LocalContact",
// the format that the data should be in when
// it is returned
contentType: "json",
// the function that executes when the server
// responds to this ajax request successfully
success: function (data) {
$.each(data, function (index, item) {
alert(item.Name);
//getting items here but are not binded to multiselect
$(".mySelect").append('<option>' + item.Name + '</option>')
});
} //end of success
}); //end of ajax
var required = $("#required").kendoMultiSelect().data("kendoMultiSelect");
var all = $.map(required.dataSource.data(), function (dataItem) {
return dataItem.value;
});
required.value(all);
$("#get").click(function () {
alert("Attendees:\n\nRequired: " + required.value());
return false;
});
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER