I am using multiselect dropdown and binding it from sql
database using jquery JSON
. I am getting values, and also in code it's appending it without any error. But items are not showing up in UI.
As image shown, I am getting elements as an array and also its appending.
But Items are not showing in UI
Below is my code :
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="dummy.aspx.cs" Inherits="WREFKAIProjevtWIPTracker.WIPTracker.dummy" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css' />
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.14.0-beta2/css/bootstrap-select.min.css' />
</head>
<body>
<form id="form1" runat="server">
<select id="ddlmultiselect" class="selectpicker" multiple aria-label="Default select example" data-live-search="true">
</select>
<script src='https://code.jquery.com/jquery-3.6.0.min.js'></script>
<script src='https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.14.0-beta2/js/bootstrap-select.min.js'></script>
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script>
var $j = jQuery.noConflict();
$j(function () {
BindDDL();
});
function BindDDL() {
//debugger;
var $s = jQuery.noConflict();
var d = '{flag:"7"}';
$s.ajax({
type: "POST", //GET or POST or PUT or DELETE verb
url: "../WIP.asmx/BindGrid",
data: d,
contentType: "application/json; charset=utf-8",
dataType: "json", //Expected data format from server
success: function (Response, status, xhr) {
$s("#ddlmultiselect").empty();
$s("#ddlmultiselect").append($("<option></option>").val(0).html("--Select--"));
$s(Response.d).each(function (value, item) {
$s("#ddlmultiselect").append($s("<option></option>").val(item.ID).html(item.iValue));
});
//$s("#ddlKAIServiceLine").append(ddl);
},
error: function (error) {
// unBlockUI();
},
complete: function () {
// unBlockUI();
},
failure: function () {
// unBlockUI(); alert("Sorry, we were unable to find the records.");
}
});
}
</script>
</form>
</body>
</html>