I have a combobox that is filled with a datasource. It filters the dropdown as I type. When I press the enter key, it simply closes the combobox and does nothing. I tried using the onClientKeyPressing event and monitoring on the enter key, but that prevents the combobox from filtering the dropdown entries.
What I want to happen is to be able to type and the dropdown entries filter. When the I press the enter key, I want to execute some javascript code. I want to be able to execute javascript code when the user either selects an entry from the dropdown or presses the enter key.
Here is what I have that does not work.
What I want to happen is to be able to type and the dropdown entries filter. When the I press the enter key, I want to execute some javascript code. I want to be able to execute javascript code when the user either selects an entry from the dropdown or presses the enter key.
Here is what I have that does not work.
<
telerik:RadComboBox
ID
=
"CustomerSearch"
runat
=
"server"
Width
=
"180"
Height
=
"160"
MarkFirstMatch
=
"true"
AllowCustomText
=
"true"
CssClass
=
"CustomerSearch"
AutoPostBack
=
"false"
OnClientKeyPressing
=
"HandleKeyPress"
EnableVirtualScrolling
=
"true"
ShowMoreResultsBox
=
"true"
EmptyMessage
=
"Enter last, first to search..."
BackColor
=
"White"
Skin
=
"Forest"
/>
<
asp:SqlDataSource
ID
=
"dsCustomer"
runat
=
"server"
SelectCommand
=
"CustomerSearchName"
SelectCommandType
=
"StoredProcedure"
></
asp:SqlDataSource
>
<
telerik:RadScriptBlock
ID
=
"RadScriptBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function searchnav(sender, args) {
var iframe = document.getElementById('ctl00_iMainPages');
if (sender.get_value() != null && sender.get_value() != '') {
iframe.src = sender.get_value() + '&T=Client';
}
}
function HandleKeyPress(sender, args) {
if (e.get_domEvent().keyCode == 13) {
searchnav(sender, args);
}
}
</
script
>
</
telerik:RadScriptBlock
>