Bind (Populate) multiple DropDownList on selection of another DropDownList value in ASP.Net MVC

malar
 
on Nov 19, 2021 05:43 AM
286 Views

Hi Team,

I have 5 DropDownList in one view.  If i change 1 DropDownList, based on that value other 4 DropDownList values need to change.

All DropDownList are binded in list. If i bind with JQuery, Based on Json result, it is binding for single dropdown.

How can we implement the same for multiple dropdown with Json or any other way?

For Single dropdown binding i had used the following way.

function onPGChange(val) {
    var PG = val;
    $.ajax({
        type: "GET",
        url: "/Item/GetDimPG",
        data: { PG: val },
        dataType: "json",
        success: function (data) {
            var select = $("#drpDimProductGroup");
            select.empty();
            var markup = "";
            for (var x = 0; x < data.length; x++) {
                markup += "<option value=" + data[x].DimProductGroupID + ">" + data[x].Description + "</option>";
            }
            $("#drpDimProductGroup").html(markup).show();
        }
    });
}

Thanks in Advance.

Download FREE API for Word, Excel and PDF in ASP.Net: Download