HI,
I am trying to set values to multi select drop down .
The values are getting selected but the selected value text is not displayed on the text box.
What I have tried:
ASPX page
Ajax to set the value for Multi select drop down
$.ajax({
url: 'NewTicket.aspx/getEditDate',
data: "{'TicketId':'" + obj + "'}",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
success: function (data) {
var TicketId = data.d.TicketId;
$('#ContentPlaceHolder1_hdnTicketId').val(TicketId);
$('#ContentPlaceHolder1_txtCustomer').val(data.d.CustomerName);
debugger;
//$('#ContentPlaceHolder1_txtName').val();
//$('#ContentPlaceHolder1_file2').val(data.d.Comments);
var IssueSummary = data.d.IssueSummary;
// $('#ddlissurtopic').select2("val", IssueSummary)({
// });
///To get Issue Summary for multi select
$('#ddlissurtopic').val(IssueSummary);
var selectedOptions = IssueSummary.split(',');
for (var i in selectedOptions) {
var optionVal = selectedOptions[i];
$("ddlissurtopic").find("option[value=" + optionVal + "]").prop("selected", "selected");
}
// $("ddlissurtopic").multiselect('reload');
// var opts = IssueSummary.split(",");
// $.each(IssueSummary.split(","), function (i, e) {
// $("#ddlissurtopic option[value='" + e + "']").prop("selected", true);
// });
$('.select2-selection--multiple').attr('aria-expanded','true');
//$('#ddlissurtopic').trigger("change");
// $.each(opts, function (inx, val) {
// $('#ddlissurtopic option[value=' + val + ']').attr('selected', true);
// })
// $('#ddlissurtopic').val(IssueSummary);
//$("#ddlissurtopic").val(data.SpecialInstructions);
// $('#ddlissurtopic').multiselect("refresh");
//$('#ddlissurtopic').multiSelect("select", IssueSummary);
//$('#ddlissurtopic').setAttribute("aria-hidden", "false");
// $('#ddlissurtopic').val(data.d.IssueSummary);
},
error: function (err) {
alert(err);
console.log(err);
}
});