Cascading Dropdowns
-
I am sure this has been asked a million times, but I am going to ask again because I can't find a good answer to my specific issue. I am using MVC asp.net and I want to load data through Ajax when a row in a Telerik grid goes into edit mode. I can get the data to load and everything is good, but I can't get the cascading drop down to work. Here is my change event code, the error is somewhere in here:
$(document).ready(function () { $('#categoryId').live('change', function () { var defects = $('#defectId'); if ($('#categoryId option:selected').val() != '') { $.ajax({ data: { categoryId: $('categoryId option:selected').val() }, type: "GET", url: '@Url.Action("\_GetDefectsByCategory", "Observation")', success: function (data) { defects.dataBind(data); defects.reload(); alert("Successfully bound."); }, error: function () { alert("Failed to bind defects."); } }) }; }); });
The alerts are there for debugging purposes, obviously. I am not natively a JScript person as I typically work in strictly OO Client-Server environments, any help would be appreciated. Cheers, --EA
-
I am sure this has been asked a million times, but I am going to ask again because I can't find a good answer to my specific issue. I am using MVC asp.net and I want to load data through Ajax when a row in a Telerik grid goes into edit mode. I can get the data to load and everything is good, but I can't get the cascading drop down to work. Here is my change event code, the error is somewhere in here:
$(document).ready(function () { $('#categoryId').live('change', function () { var defects = $('#defectId'); if ($('#categoryId option:selected').val() != '') { $.ajax({ data: { categoryId: $('categoryId option:selected').val() }, type: "GET", url: '@Url.Action("\_GetDefectsByCategory", "Observation")', success: function (data) { defects.dataBind(data); defects.reload(); alert("Successfully bound."); }, error: function () { alert("Failed to bind defects."); } }) }; }); });
The alerts are there for debugging purposes, obviously. I am not natively a JScript person as I typically work in strictly OO Client-Server environments, any help would be appreciated. Cheers, --EA
Seems like you're missing a # in the line here:
data: { categoryId: $('categoryId option:selected').val() },
Should be...
data: { categoryId: $("#categoryId option:selected").val() },