Senorita

Senorita

  • NA
  • 123
  • 8.7k

Multiple Select (MultiSelect) DropDownList with CheckBoxes

Jun 2 2020 12:03 AM
Hi ,
 
In my asp.net web application i am Multiple Select (MultiSelect) DropDownList with CheckBoxes in ASP.Net using jQuery. but only thing is here drop down bind hard code and i have to bind dynamically ajax call method.
 
with help of  below artical:-
https://www.aspsnippets.com/Articles/Multiple-Select-MultiSelect-DropDownList-with-CheckBoxes-in-ASPNet-using-jQuery.aspx
--  
 
so i used below line of code
<asp:DropDownList ID="drpcomp" runat="server" DataSource="<%#tds.GetCompany %>" DataTextField="CompNmae" DataValueField="CompNmae" onchange="popup(this)"></asp:DropDownList>
function popup(obj) {
// alert(obj.value);
var company = obj.value
debugger;
$.ajax({
type: "POST",
url: "TML_GST_Invoice_Adjust.aspx/getBu",
data: "{company:" + JSON.stringify(company) + "}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (r) {
var ddlbu1 = $("[id*=ddlbu1]");
ddlbu1.empty();
$.each(r.d, function () {
//alert(this['Value'])

ddlbu1.append($("<option></option>").val(this['Value']).html(this['Text']));
});
}
});

}
but my drop down not bind i debug the code there is no error. 
 
 

Answers (3)