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

Browser crashes when adding Rad ComboBox Item with JavaScript

4 Answers 80 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 24 Jun 2013, 06:47 PM
I'm trying to set the value of a combo box that uses javascript to clear the items, add one, and set the only item as selected. Everything works except for setting the newly added item as the selected item. When this is triggered, it causes IE9 to crash.

Any ideas? BTW, I'm using 2013 Q1.

<telerik:RadComboBox ID="RCB_Build" runat="server" CheckBoxes="true" EmptyMessage="Select all that apply" OnClientSelectedIndexChanged="toggleFields"  EnableCheckAllItemsCheckBox="true" TabIndex="5" ToolTip="Select the schedule month(s)" AutoPostBack="false">
 <ExpandAnimation Type="OutExpo" Duration="300" />
 <CollapseAnimation Type="InExpo" Duration="200" />
                                </telerik:RadComboBox>

var RCB_Build = $find('<%=RCB_Build.ClientID%>');
var rcbItem = new Telerik.Web.UI.RadComboBoxItem();
rcbItem.set_text(n);
rcbItem.set_value(fom);
RCB_Build.trackChanges();
RCB_Build.clearItems();
RCB_Build.get_items().add(rcbItem);
rcbItem.select();
RCB_Build.commitChanges();

4 Answers, 1 is accepted

Sort by
0
Matt
Top achievements
Rank 1
answered on 26 Jun 2013, 12:36 PM
Anyone?

Is there a way to use JavaScript to remove the option of a select all option?
0
Nencho
Telerik team
answered on 27 Jun 2013, 07:14 AM
Hello Matt,

Would you elaborate a bit more on the scenario you attempt to achieve? Is the code snippet, where you are demonstrating how you are adding the new RadComboBoxItem, is placed in the OnClientSelectedIndexChanged client-side event handler? If the RadComboBox has its CheckBox functionality enabled, I would suggest you to use the OnClientItemChecked client-side event instead of the OnClientSelectedIndexChanged. In addition, I noticed that you are using the select() method, in order to check the newly added item. This is the reason why this functionality causes the browser to crash. In a checkboxes scenario, you should use the check() function instead.

As for you other inquiry, regarding the removal of the "Check All" option, I would suggest you to use JQuery, in order to remove it. Please consider the following approach:     $telerik.$(".rcbCheckAllItems").hide()

Regards,
Nencho
Telerik
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 RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Matt
Top achievements
Rank 1
answered on 27 Jun 2013, 11:54 AM
Thanks Nencho!

I'm calling the function from another rad combobox (client selected change) and using what you suggested works perfectly.

I wish I could have found that solution online though.
0
Nencho
Telerik team
answered on 28 Jun 2013, 01:21 PM
Hello Matt,

I am glad to see that the issue is now resolved. Thank you for your feedback, we will update our documentation on the matter. However, an another approach is applicable, using the set_checked() method, like demonstrated in this help article.

Regards,
Nencho
Telerik
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 RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
ComboBox
Asked by
Matt
Top achievements
Rank 1
Answers by
Matt
Top achievements
Rank 1
Nencho
Telerik team
Share this question
or