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

How do I make a rad combobox fire when the user enters text and hits ENTER?

1 Answer 81 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Acadia
Top achievements
Rank 1
Iron
Acadia asked on 20 Jan 2009, 06:36 PM
<telerik:RadComboBox ID="rcCS" runat="server" AllowCustomText="true" Width="200px">     
    
</telerik:RadComboBox>    
    
&nbsp;     
    
<asp:ImageButton ID="ibSelect" runat="server" ImageUrl="../images/ffwd.gif" ImageAlign="Middle"    
    
ToolTip="Click to perform search"></asp:ImageButton>    
 


What I want to do is when the user enters custom text into the rad combo above, then hits ENTER, for the ibSelect ImageButton to act as though it was clicked.  This works with a textbox but I can't get it to work with the combo.  I don't want to use AutoPostBack.

thanks!

1 Answer, 1 is accepted

Sort by
0
Accepted
Veselin Vasilev
Telerik team
answered on 22 Jan 2009, 09:41 AM
Hello Acadia,

You need to subscribe to OnClientKeyPressing event, check if the pressed key is the Enter (keyCode = 13) then find the image object and call its click() method.

function OnClientKeyPressingHandler(sender, eventArgs) 
    if (eventArgs.get_domEvent().keyCode == 13) 
    { 
        var image = $get("<%= ibSelect.ClientID %>"); 
        image.click(); 
    } 

I hope this helps.

Kind regards,
Veselin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
Acadia
Top achievements
Rank 1
Iron
Answers by
Veselin Vasilev
Telerik team
Share this question
or