How do I get combobox type in javascript

2 posts, 0 answers
  1. Matthew
    Matthew avatar
    25 posts
    Member since:
    Aug 2011

    Posted 06 Jul 2012 Link to this post

    I have a switch statement in a javascript function that performs different actions based on the type of control that is being passed, however the sender.type of the RadComboBox is null. How do I get the type?

    here is my javascript function:

    function RefreshCsiOptions(sender) {
                switch (sender.type) {
                    case "radio":
                        if (sender.checked == true) {
                            for (i = 0; i < cbxCSI.length; i++) {
                                var z = rcbCSI[i];
                                if (rcbCSI[i].get_selecteditem().get_value() != "") { rcbCSI[i].disabled = "disabled"; } else { cbxCSI[i].disabled = true; }
                                cbxCSI[i].checked = false;
                            }
                            lblWithoutCSI.disabled = "";
                        }
                        break;
                    case "checkbox":
                        var cbxNumber = sender.id.substr(6, 1);
                        if (sender.checked == true) {
                            rcbCSI[cbxNumber - 1].disabled = "";
                            lblWithoutCSI.disabled = "disabled";
                            rbWITHOUT.checked = false;
                        } else {
                            rcbCSI[cbxNumber - 1].disabled = "disabled";
                        }
                        CheckWithoutStatus();
                        break;
                    case "select-one":
                        var rcbNumber = sender.id.substr(14, 1);
                        if (rcbNumber == "_") rcbNumber = "0";
                        var rcbValue = rcbCSI[rcbNumber].get_selecteditem().get_value();
                        document.Form1.elements['CSI' + rcbNumber + '_value'].value = rcbValue;
                        if (rcbValue != "") {
                            cbxCSI[rcbNumber].disabled = false;
                            cbxCSI[rcbNumber].checked = true;
                            if (rbWITHOUT.checked == true) rbWITHOUT.checked = false;
                        } else {
                            cbxCSI[rcbNumber].disabled = true;
                            cbxCSI[rcbNumber].checked = false;
                            CheckWithoutStatus();
                        }
                        break;
                    default:
                        //alert(sender.type);
                        break;
                }
            }  
  2. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 09 Jul 2012 Link to this post

    Hi Matthew,

    Could you please send us more information regarding the exact your scenario?
    Where do you call the RefreshCsiOptions function?
    Could you please send us a complete sample to examine it locally?

    Greetings,
    Nencho
    the Telerik team
    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 their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top