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

[Solved] RadComboBox with checkboxes item template does not work properly on IE6

1 Answer 157 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Ruth Dahan
Top achievements
Rank 1
Ruth Dahan asked on 13 Sep 2009, 10:18 AM
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:

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

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 17 Sep 2009, 06:37 AM
Hi Ruth,

I tried to replicate this issue with the provided code but to no avail. Could you please open a support ticket and send us a simple page demonstrating the problem? Thanks

Best wishes,
Yana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
ComboBox
Asked by
Ruth Dahan
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or