Hi,
I am using RadComboBox with item template of checkboxes as described in the demo:
http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/templates/defaultcs.aspx
I am setting the checked items using javascript. this code works perfectly on all browsers but IE6. in IE6 the checkboxes are not checked.
Has anybody encoutered such problem?
This is my javascript code:
Thanks is advance,
Ruth
I am using RadComboBox with item template of checkboxes as described in the demo:
http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/templates/defaultcs.aspx
I am setting the checked items using javascript. this code works perfectly on all browsers but IE6. in IE6 the checkboxes are not checked.
Has anybody encoutered such problem?
This is my javascript code:
| function onCheckBoxClick(chk) { |
| var combo = $find("<%=cmbExt.ClientID %>"); |
| //holds the text of all checked items |
| var text = ""; |
| //holds the values of all checked items |
| var values = ""; |
| //get the collection of all items |
| var items = combo.get_items(); |
| //enumerate all items |
| for (var i = 0; i < items.get_count(); i++) { |
| var item = items.getItem(i); |
| //get the checkbox element of the current item |
| var chk1 = $get(combo.get_id() + "_i" + i + "_chk1"); |
| if (chk1.checked) { |
| text += item.get_text() + ", "; |
| values += item.get_value() + ","; |
| } |
| } |
| //remove the last comma from the string |
| text = removeLastComma(text); |
| values = removeLastComma(values); |
| var extValues = document.getElementById("<%= hiddenExtensions.ClientID %>"); |
| extValues.value = values; |
| var ExtValuesHiddenField = document.getElementById("<%=ExtValuesHiddenField.ClientID %>"); |
| ExtValuesHiddenField.value = values; |
| if (text.length > 0) { |
| //set the text of the combobox |
| combo.set_text(text); |
| combo.ToolTip = text; |
| } |
| else { |
| //all checkboxes are unchecked |
| //so reset the controls |
| if (items.get_count() == 0) { |
| var HiddenFieldNoExtensionsString = document.getElementById("<%=HiddenFieldNoExtensionsString.ClientID %>"); |
| combo.set_text(HiddenFieldNoExtensionsString.value); |
| } |
| else { |
| var HiddenFieldSelectExtensionsString = document.getElementById("<%=HiddenFieldSelectExtensionsString.ClientID %>"); |
| combo.set_text(HiddenFieldSelectExtensionsString.value); |
| } |
| } |
| } |
| //this method removes the ending comma from a string |
| function removeLastComma(str) { |
| return str.replace(/, $/, ""); |
| } |
| function ExtensionsComboClientLoad(sender) { |
| var extValues = document.getElementById("<%= hiddenExtensions.ClientID %>"); |
| var ExtValuesHiddenField = document.getElementById("<%=ExtValuesHiddenField.ClientID %>"); |
| ExtValuesHiddenField.value = extValues.value; |
| var combo = $find("<%=cmbExt.ClientID %>"); |
| //get the collection of all items |
| var items = combo.get_items(); |
| var text = ""; |
| if (extValues != null && extValues.value != null && extValues.value != "") { |
| var ext_array = extValues.value.split(", "); |
| for (var j = 0; j < ext_array.length; j++) { |
| //enumerate all combo items |
| for (var i = 0; i < items.get_count(); i++) { |
| var item = items.getItem(i); |
| //get the checkbox element of the current item |
| var chk1 = $get(combo.get_id() + "_i" + i + "_chk1"); |
| var itemitemValue = item.get_value(); |
| if (itemValue == ext_array[j]) { |
| chk1.checked = true; |
| text += item.get_text() + ", "; |
| } |
| } |
| } |
| } |
| if (text.length > 0) { |
| //remove the last comma from the string |
| text = removeLastComma(text); |
| //set the text of the combobox |
| combo.set_text(text); |
| combo.ToolTip = text; |
| } |
| else { |
| if (items.get_count() == 0) { |
| var HiddenFieldNoExtensionsString = document.getElementById("<%=HiddenFieldNoExtensionsString.ClientID %>"); |
| combo.set_text(HiddenFieldNoExtensionsString.value); |
| } |
| else { |
| var HiddenFieldSelectExtensionsString = document.getElementById("<%=HiddenFieldSelectExtensionsString.ClientID %>"); |
| combo.set_text(HiddenFieldSelectExtensionsString.value); |
| } |
| } |
| } |
Thanks is advance,
Ruth