Combobox change from select to search

2 posts, 0 answers
  1. Espen Fosshaug
    Espen Fosshaug avatar
    18 posts
    Member since:
    Sep 2009

    Posted 15 Aug 2011 Link to this post


    I have a radcombobox that fills on demand from a sql-query, it is used to find users, companies, servers and so on. Works very good.
    But, I would like to change it to a broader search if the text is not found.

    <telerik:RadComboBox ID="rcomSearch" runat="server" OnItemsRequested="rcomSearch_ItemsRequested"
                    EnableLoadOnDemand="true" DataTextField="text1" DataValueField="typeid" MarkFirstMatch="true"
                    AutoPostBack="False" HighlightTemplatedItems="true" EmptyMessage="Søk i IBA..."
                    OnSelectedIndexChanged="rcomSearch_SelectedIndexChanged" LoadingMessage="Henter..."
                    Width="300px"  OnClientSelectedIndexChanged="OnClientSelectedIndexChanged"
                    Visible="true"  AllowCustomText="True"    >

    So, OnSelectedIndexChanged i will go directly to the found object, but if I press Enter with text in the box I would like to response.redirect to a Search-page and give a list of results there.
    Anyone knows how to do this?
  2. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 15 Aug 2011 Link to this post

    Hello Espen,

    Have you tried handling the OnClientTextChange event? It will fire when you press Enter in the RadComboBox. The downside is that It also fires when the control loses focus, so handling the OnClientKeyPressing event might be a better choise if you only want it to fire when they press Enter.

    I hope that helps.
Back to Top