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

SelectedIndexChanged not firing until blur or enter

6 Answers 279 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
TD
Top achievements
Rank 1
TD asked on 26 Jan 2009, 10:19 PM
I have a combobox that updates other parts of the form as the user changes the value. However, my users want to change the value with the keyboard, not just with the mouse. When they use the keyboard (with either the up/down keys, or the letters of the item to select (MarkFirstMatch is = to true)) the SelectedIndexChanged event does not fire unless they tab out of the control or hit enter.
I have tried attaching to the OnClientTextChange, OnClientSelectedIndexChanged and OnClientSelectedIndexChanging events, but those don't seem to be firing until the blur or enter either.
I did get it to work with OnKeyPressing, but that event seems to fire before teh MarkFirstMatch code executes so my code only sees the letters typed so far. So if they Type "C" I get C instead of the value "Cat" that C would match.

The drop down is responding to C and selecting cat, it's just firing all but the key pressing events only on blur or enter, and the keypressing event to early for my needs.

Is there some setting that I can change to make this control fire the event they way the standard ASP:dropdownlist does? (ie, on down arrow, or typing the first letter of the item to select)

Thanks.

6 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 30 Jan 2009, 03:43 PM
Hello TD,

Indeed this is the current behavior of RadComboBox.

I suggest you try using a different approach in this case:

  • Set the MarkFirstMatch property to false;
  • Handle the ClientKeyPressing event - use the findItemByText method of the RadComboBox to get the first matching Item or null if such Item does not exist;
  • Use the Item per your requirements;
  • You could also call the Item's highlight method to highlight it similarly to the MarkFirstMatch functionality;
Best wishes,
Simon
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Eleni Vlachou
Top achievements
Rank 1
answered on 28 Aug 2009, 11:48 AM
Are you planning to change such behavior?

Cause it is more reasonable to use common approach and fire SelectedIndexChanged when standart cortols do.
We also have a problem because of such behavior and i suppose that using hacks such as findItemByText is not very nice solution

UPD: besides we can have two items in the combo box with the same text but different values, findItemByText will find only first match, but we will need the exact item.
0
Simon
Telerik team
answered on 02 Sep 2009, 10:48 AM
Hi Eleni Vlachou,

In this case you can use findItemByValue which goes the other way around - it finds an Item by its value.

Sincerely yours,
Simon
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.
0
John
Top achievements
Rank 2
answered on 16 Dec 2009, 04:37 PM
I have the same problem!!! When a user selects a value from one Combo and navigates away from it using Tab on the keyboard, the SelectedIndexChanging event does not fire (altough the index has changed!) and hence the next Combo is not updated as intended.

Lately I find myself writing a lot of workarounds for such problems with the Client Side API. I thought that using your components was supposed to isolate me of doing such things!

Thanks
0
Veselin Vasilev
Telerik team
answered on 18 Dec 2009, 02:18 PM
Hello Bidan,

I could not reproduce the problem in our Related Comboboxes online demo, can you?
What is different in your case?

Sincerely yours,
Veselin Vasilev
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.
0
John
Top achievements
Rank 2
answered on 18 Dec 2009, 02:52 PM
Hi Veselin, thanks a lot for your response!

In the mean time since my last writing, I realized that the actual problem that I have is entirely different. I think that I will open a ticket with the problem because it does apply to this thread
Tags
ComboBox
Asked by
TD
Top achievements
Rank 1
Answers by
Simon
Telerik team
Eleni Vlachou
Top achievements
Rank 1
John
Top achievements
Rank 2
Veselin Vasilev
Telerik team
Share this question
or