SelectedIndexChanged not firing until blur or enter

7 posts, 0 answers
  1. TD
    TD avatar
    1 posts
    Member since:
    Aug 2008

    Posted 26 Jan 2009 Link to this post

    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.
  2. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 30 Jan 2009 Link to this post

    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.
  3. Eleni Vlachou
    Eleni Vlachou avatar
    1 posts
    Member since:
    Aug 2008

    Posted 28 Aug 2009 Link to this post

    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.
  4. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 02 Sep 2009 Link to this post

    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.
  5. John
    John avatar
    41 posts
    Member since:
    Nov 2007

    Posted 16 Dec 2009 Link to this post

    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
  6. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 18 Dec 2009 Link to this post

    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.
  7. John
    John avatar
    41 posts
    Member since:
    Nov 2007

    Posted 18 Dec 2009 Link to this post

    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
Back to Top