In my telerik window, I am loading a dropdownlist based on another dropdownlist onchange event (It works fine). But what ever the action I do telerik window the onchange event of the dropdown is firing.
Based on this dropdown list change I am loading another dropdownlist,
@(Html.Telerik().DropDownListFor(m => m.VLC_COST_GEN)
.Placeholder("Select General Cost..")
.ClientEvents(events => events
.OnLoad("Areas.APUIAdmin.CostCodes.loadGeneralCost")
.OnChange("Areas.APUIAdmin.CostCodes.loadCostCategoryOnGeneralChange"))
.HtmlAttributes(new { style = "width:70%" })
JS Code I have used to load the another dropdownlist on change,
loadCostCategoryOnGeneralChange: function (e) {
$.getJSON("/APUIAdmin/CostCodes/GetReferenceDataOnChnage?strDomian=VLC_COST_CAT" + "&strHighVal=" + e.value, function (data) {
$("#VLC_COST_CAT").data("tDropDownList").dataBind(data);
$("#VLC_COST_CAT").data("tDropDownList").select(0);
});
}
The second dropdownlist which I am loading in the onchange of first one,
@(Html.Telerik().DropDownListFor(m => m.VLC_COST_CAT)
.Placeholder("Select Cost Category")
.BindTo(new SelectList(Starnet.Web.AP.UIAdmin.ReferencedData.GetReferenceData("VLC_COST_CAT", Model.VLC_COST_GEN), "RV_LOW_VALUE", "RV_MEANING"))
.ClientEvents(events => events
.OnChange("Areas.APUIAdmin.CostCodes.loadServiceTypeOnCategoryChange"))
.HtmlAttributes(new { style = "width:70%" })
)
}