ClientSelectedIndexChanged not firing

4 posts, 0 answers
  1. Andrew
    Andrew avatar
    3 posts
    Member since:
    Jun 2013

    Posted 02 Jul 2013 Link to this post

    I have an oddly behaving comboBox.

    Here's my markup

                    enablevirtualscrolling="True" >   
                <WebServiceSettings Method="GetSitesComboBoxDataByCustomerId" Path="/Services/ClientSideDataService.asmx" />

    Pretty reasonable, comboBox is tied to a webservice.

    The onItemsRequesting function adds some extra data bits to the comboBox context that we need.

    function rcbSite_OnClientItemsRequesting(sender, eventArgs) {
            //Get the selected customer
            var selectedCustomerId = $('#<%= CustomerDropDownId %> option:selected').attr('value');
            var context = eventArgs.get_context();
            //Set filter text
            context["FilterString"] = eventArgs.get_text();
            context["CustomerId"] = selectedCustomerId;

    In my codebehind I create and select an item if one was previously chosen.
    if (siteId.HasValue)
         rcbSite.SelectedValue = siteId.Value.ToString();

    And finally on document.ready I attach a selctedIndexChanged event to the comboBox

                //If the combo box has items in it, select the first one
                //Selecting first item client side ensures that address fields are refreshed when binding individual item to combo box on initial page load
                var combo = $find("<%= rcbSite.ClientID %>");
                if (combo.get_items().getItem(0)) {
                $find("<%= rcbSite.ClientID %>").add_selectedIndexChanged(
                function (sender, eventArgs) {
                    var item = eventArgs.get_item();
                    var addressFormFields = new InventoryAddressFields("<%= ddlAddressType.ClientID %>", "<%= txtAttenTo.ClientID %>", "<%= txtAddress1.ClientID %>",
                                                                   "<%= txtAddress2.ClientID %>", "<%= txtCity.ClientID %>", "<%= ddlCountry.ClientID %>",
                                                               "<%= ddlState.ClientID %>", "<%= ddlCounty.ClientID %>", "<%= txtPostalCode.ClientID %>",
                                                               "<%= txtPostalCodePlus4.ClientID %>", "<%= txtPhone.ClientID %>", "<%= txtFax.ClientID %>",
                                                               "<%= ddlTimezone.ClientID %>", "<%= chkObserveDST.ClientID %>", "<%= ddlVerificationStatus.ClientID %>");
                    if (item) {
                        var selectedSiteId = item.get_value();
                        GetAddressBySiteId(addressFormFields, selectedSiteId);

    Here's my issue:

     1. Page loads with one item inserted into comboBox & selected
     3. Click into comboBox & hit backspace
     4. Click off the comboBox

    ComboBox fires a selectedIndexChanged event since we now have no item selected

    Item is removed without firing event

    What's interesting is that if you click into the box and off without removing an item. Then click in and remove it, the event fires correctly.

    Any ideas?

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 03 Jul 2013 Link to this post

    Hi Andrew,

    The server and client SelectedIndexChanged event does not fire unless the AutoPostBack property is True. Try setting the AutoPostBack property of the RadComboBox to true and check if the problem still exist.

  3. DevCraft R3 2016 release webinar banner
  4. Andrew
    Andrew avatar
    3 posts
    Member since:
    Jun 2013

    Posted 03 Jul 2013 Link to this post

    That's not really true,

    the client selectedIndexChanged seems to fire correctly in every case except this one.

    Maybe it's intended behavior that you can't pre-fill the comboBox with some items then later pull from a service.
  5. Andrew
    Andrew avatar
    3 posts
    Member since:
    Jun 2013

    Posted 05 Jul 2013 Link to this post

    I have a workaround in place now, it seems like what I wanted is unsupported behavior of the comboBox.
Back to Top