<asp:DropDownList ID="ddlBranch" runat="server" onchange="BindEmployeeNames()" data-md-selectize> <asp:ListItem Value="0">Select</asp:ListItem> </asp:DropDownList>
<asp:DropDownList ID="ddlEmployeeNames" runat="server" data-md-selectize> </asp:DropDownList>
var ddlEmployeeNamesItems; function BindEmployeeNames() { //alert("k"); var ddlBranchCtrl = document.getElementById("<%=ddlBranch.ClientID %>"); ddlEmployeeNamesItems = document.getElementById("<%=ddlEmployeeNames.ClientID %>"); ddlEmployeeNamesItems.options.length == 0; // alert(ddlBranchCtrl.options[ddlBranchCtrl.selectedIndex].value); PageMethods.FillEmpData(ddlBranchCtrl.options[ddlBranchCtrl.selectedIndex].value, OnSuccess); } function OnSuccess(response) { //alert(response); ddlEmployeeNamesItems.options.length = 0; AddOption("Select", "0"); for (var i in response) { //alert(response[i].Name + "------------" + response[i].Id); AddOption(response[i].Name, response[i].Id); } } function AddOption(text, value) { var option = document.createElement('option'); option.value = value; option.innerHTML = text; document.getElementById("<%=ddlEmployeeNames.ClientID %>").options.add(option); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)