Populate ListBox using jQuery AJAX and apply Bootstrap MultiSelect plugin in ASP.Net

Last Reply on Dec 09, 2016 03:28 AM By dharmendr

Posted on Dec 07, 2016 04:51 AM

HI,

i am trying to bind data to multi select list box in jquery

here is code:

 

  function GetPlotsbyReservation(district, industry,rsvr) {
        $.ajax({
            type: "POST",
            url: "kiadb.asmx/GetPlotsbyReservation",
            data: "{'District':'" + district + "','industry':'" + industry + "','rsvr':'" + rsvr + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: OnSuccess,
            error: OnError
        });

        function OnSuccess(data, status) {
            var myObject = JSON.parse(data.d);

            var len = myObject.length;
            var listItems = "";
        
            for (var i = 0; i < len; i++) {
                $('#ddlPlot').append('<option value="' + myObject[i].rsvr + '">' + myObject[i].rsvr + '</option>');
               
               
            }
       
        }

        function OnError(request, status, error) {
            alert(request.statusText);
        }
    }

 

 <asp:ListBox ID="ddlPlot" runat="server" SelectionMode="Multiple" ></asp:ListBox>

data is not binding to list box.can any one help me

This question does not have replies that have been liked.