Help Achieve Filtering as described

4 posts, 0 answers
  1. Keith
    Keith avatar
    4 posts
    Member since:
    Jun 2009

    Posted 13 Jan 2010 Link to this post

    We are trying to add a filtered RadComboBox control that behaves as follows:
    -  When you start typing, filter the list with the Contains filter
    -  If you leave the control (blur), and your current text doesn't match an existing item in the list, revert to the item that was selected when the page was loaded (the current value before the user started typing the filter key)

    Our current attempt is close, but doesn't quite get there.  On blur, the combobox retains the value of whatever the user typed in, even though AllowCustomText is false.  If we set MarkFirstMatch to true, we prevent the user from leaving any text in the dropdown that doesn't match an existing item, however we would prefer to clear it out to its original value if an item wasn't selected directly:

    <telerik:RadComboBox ID="_sicCode" runat="server" AllowCustomText="false" MarkFirstMatch="false" EmptyMessage="-- Select --" Filter="Contains" MaxHeight="150" /> 

    Is there any way to achieve this behavior without extending the control?
  2. Jose
    Jose avatar
    49 posts
    Member since:
    Aug 2008

    Posted 13 Jan 2010 Link to this post

    Hi Keith.

    If you use the client side event OnClientBlur then you can control what to put on the control once the user leaves it. You can use a hidden field to store the default value, and when the user selects an item of the filtered list, using the OnClientSelectedIndexChanged event you can modify the hidden field value so store the new selection so you always have a way to go back to the previous selection.

    Hope this helps.

    Jose Guay
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Keith
    Keith avatar
    4 posts
    Member since:
    Jun 2009

    Posted 13 Jan 2010 Link to this post

    Thank you Jose.

    This makes sense, and was what I was thinking of doing if I chose to extend the control (or create a user control).  I was hoping there was something we could do out of the box, and avoid reinventing the wheel if it was in fact already supported without doing what you mention.  Anyone from Telerik have some input on this?
  5. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 18 Jan 2010 Link to this post

    Hi Keith,

    It is not supported out of the box because there are scenarios where a different behavior is expected.
    That is why we provide a rich client side API in terms of methods and events so you can fine tune the behavior per your requirements.


    Kind regards,
    Veskoni
    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.
Back to Top