Delete RadCombo on client Side

3 posts, 0 answers
  1. Emmanuel
    Emmanuel avatar
    18 posts
    Member since:
    Oct 2010

    Posted 16 Mar 2011 Link to this post

    I have a ListBox and each time one item is selected a RadCombo is added to my page with the ID = Selected value in the listbox. On server side my code verifies to not duplicate the Radcombo. There is a button for each RadCombo to remove it from the page. The delete action is made on client side with Jquery code and it just empty the div containing radcombo and other controls. Unfortunately Telerik doesn’t remove the RadCombo from its collection, and I verified there is still some div hidden with the same ID,  and still continue to work with the RadCombo and getting the following error shown in FireBug:

    header is null (header is the class of div containing the RadCombo)

    _

    evt = Object { type="click", rawEvent=, more...}
    (?)()
     
    browserHandler(e=click clientX=393, clientY=182) e = click clientX=393, clientY=182
     
    var index = header._index;

     

    My question is how can I remove the control on client site in order to not get the error.

     

    I added the following code on pageLoad event

    combos = Telerik.Web.UI.RadComboBox.ComboBoxes;
     
    //First of all how do I get the Id of each combo?
    $.each(combos, function(){this.??? // Get Name or ID});

     

    The javascript is an external file and cannot use <% =control.ClientID%>

     

    I hope that I was clear to define my issue, and would really appreciated any help.

     

     

     

  2. Emmanuel
    Emmanuel avatar
    18 posts
    Member since:
    Oct 2010

    Posted 16 Mar 2011 Link to this post

    i advanced my debug and I can get finally my comboBox object on Client side . Inside of each loop I get the Id by

    $.each(combos, function () {
         if (this._element.id.endsWith(strTableName)) {
              $(this).remove();
               return false;
          }
     });
     and the problem I had was the click bubbling to a accordion section. I fixed it now i have the following problem. When I remove a combo and I add the same combo (it will get the same ID from server side), and by clicking the arrow the list is not shown. Do you know any way that I can make this happen? another question, how can I stop bubbling of the arrow clicking. I tried to catch the event by
    $('div.ComboDrop').delegate('tr.rcbReadOnly', 'click', function (event) {
         alert('Header click');
         StopPropagation(event);
     });
     but the event is never triggered, and I don't get the alert. Thank you in advance, and sorry if my explanations are not clear.
  3. Helen
    Admin
    Helen avatar
    1052 posts
Back to Top