This question is locked. New answers and comments are not allowed.
I have a grid inside which i have two dropdown lists.
I want the functionality by which if i change value of first ddl then related to that value, second ddl should populate.
Change event of first ddl is fired but what to write inside that jquery.
Simultaneously I am using editor template for both ddls.
i am doing smthing like this but not working:
function onTypeChange(e) {
var idDept = 2;
getBranches(idDept);
}
function getBranches(idDept){
$.ajax({
url: "@Url.Action("GetBranchList", "FleetEdit")",
data: {departmentId: idDept},
dataType: "json",
type: "POST",
success: function (myData){
var items= "";
items += "<option value=\"\">" + "" + "</option>";
$.each(myData, function(i,item){
items += "<option value=\"" + item.Value + "\">" + item.Text + "</option>";
});
$('#Parentform.t-edit-form').find('#Fleet').closest('div.t-dropdown').html(items);
}
});
}
Fleet is the name of editor template of second ddl.
Please reply soon if anybody has the solution...!!!
Thanks in advance.
I want the functionality by which if i change value of first ddl then related to that value, second ddl should populate.
Change event of first ddl is fired but what to write inside that jquery.
Simultaneously I am using editor template for both ddls.
i am doing smthing like this but not working:
function onTypeChange(e) {
var idDept = 2;
getBranches(idDept);
}
function getBranches(idDept){
$.ajax({
url: "@Url.Action("GetBranchList", "FleetEdit")",
data: {departmentId: idDept},
dataType: "json",
type: "POST",
success: function (myData){
var items= "";
items += "<option value=\"\">" + "" + "</option>";
$.each(myData, function(i,item){
items += "<option value=\"" + item.Value + "\">" + item.Text + "</option>";
});
$('#Parentform.t-edit-form').find('#Fleet').closest('div.t-dropdown').html(items);
}
});
}
Fleet is the name of editor template of second ddl.
Please reply soon if anybody has the solution...!!!
Thanks in advance.