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

Combobox change from select to search

1 Answer 25 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Espen Fosshaug
Top achievements
Rank 1
Espen Fosshaug asked on 15 Aug 2011, 10:09 AM
Hi.

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?

1 Answer, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 2
answered on 15 Aug 2011, 01:23 PM
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.
Tags
ComboBox
Asked by
Espen Fosshaug
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 2
Share this question
or