This is a migrated thread and some comments may be shown as answers.

[Solved] Child Combo box is not refreshing on parent combo box change

1 Answer 104 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Narayanarao
Top achievements
Rank 1
Narayanarao asked on 10 Jan 2012, 08:31 AM

 Hi Team,

  Below is the code snippent for which I am getting for a scenario.

function getStates() {
         
       $.ajax({         
           url: "@Url.Action("GetSelectedCountryStates", "PartnerManagement")",         
           data: {countryID: $("#CountiresComboBox").val()},         
           dataType: "json",         
           type: "POST",         
           error: function() {             
               alert("An error occurred.");         
           },         
           success: function(data) {             
               var combobox = $('#StatesOrProvincesComboBox').data('tComboBox');
               combobox.close();
               combobox.dataBind(data);
               combobox.value("0");
               combobox.open();
           }     
       }); 
   }

  In almost all the scenarios my code is working fine but when I type in child combobox to filter states 
and again if I change the country then child comobo box is filling with the new values but still having
the old value selected in it.

  ex: selected country -- United States with State -- Colorado( filtered through typing in state combobox)
      then changed country -- India then state combobox is refreshing with Indian state but still showing
      Colorado in it.

   It is giving me the javascript error " 'Text' is null or not an object"

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 12 Jan 2012, 05:40 PM
Hi Narayanarao,

The code you send looks correct. Also, the ComboBox should clear all previous data when the dataBind method is used. Could you send a sample project which reproduces this behaviour, so I can examine your exact scenario?

Kind regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
ComboBox
Asked by
Narayanarao
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or