Ajax Combobox and SelectedIndex Issue

1.This is to handle Issue with Combobox When text is deleted direct Selected index doesn't Turn -1
2.Remove value which is not there is list after leave event of combobox.


                $(".ajaxComboBox :input[type=text]").each(function (i) {
                    this.onblur = function () {
                        var comboBox = $find(this.parentNode.parentNode.parentNode.parentNode.parentNode.id); // the combobox
                        //alert(comboBox._element.id);                  // Return Control ID
                        //alert(comboBox.get_textBoxControl().value);  // Return textbox value

                        if (jQuery.trim(comboBox.get_textBoxControl().value) == "")  // if textbox is empty
                        {
                            comboBox.set_selectedIndex(-1);                             // then set selected index to -1                                 }
                        else {
                            if (comboBox._highlightedIndex == -1)
                            {
                                comboBox.set_selectedIndex(-1);                             // then set selected index to -1                                     comboBox.get_textBoxControl().value = "";
                            }
                        }
                    }
                });

Comments

Popular posts from this blog

Shared / Static Class in vb.net/C#

Xamarin Forms : PopUp Page with RG.Plugins.Popup

Text was truncated or one or more characters had no match in the target code page.". (SQL Server Import and Export Wizard)