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

Delete RadCombo on client Side

2 Answers 63 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Emmanuel
Top achievements
Rank 1
Emmanuel asked on 16 Mar 2011, 08:27 PM

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 Answers, 1 is accepted

Sort by
0
Emmanuel
Top achievements
Rank 1
answered on 17 Mar 2011, 12:15 AM
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.
0
Helen
Telerik team
answered on 18 Mar 2011, 01:14 PM
Tags
ComboBox
Asked by
Emmanuel
Top achievements
Rank 1
Answers by
Emmanuel
Top achievements
Rank 1
Helen
Telerik team
Share this question
or