In attempting to make the enter key simulate a click on a button I used the following as a reference: http://www.telerik.com/community/forums/aspnet-ajax/ajax/defaultbutton-and-radajaxpanel.aspx
I put the javascript in a RadCodeBlock and set the body's onkeydown event to call it. Now the form just keeps loading and never completes.
Here is the entire code (it isn't very large) The button is on a RadAjaxPanel in the referenced SearchControl.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="HeadSearch" runat="server">
<title>General Search</title>
...
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
function keyDown(e)
{
if(e.keyCode == 13)
{
var ajaxPanel = $find("<%= RadAjaxPanelSearch.ClientID %>");
var searchButton = $find("<%= ButtonSearch.ClientID %>");
searchButton.click();
}
}
</script>
</telerik:RadCodeBlock>
</head>
<body onkeydown="keyDown(event);" onload="hideLoading();">
<form id="FormSearch" runat="server">
<telerik:RadScriptManager ID="RadScriptManagerPage" runat="server" OnAsyncPostBackError="RadScriptManagerPage_AsyncPostBackError"
EnableScriptCombine="true" OutputCompression="AutoDetect" EnablePageMethods="true">
<Scripts>
<asp:ScriptReference Path="~/Scripts/M5.js" NotifyScriptLoaded="true" />
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
</Scripts>
</telerik:RadScriptManager>
<asp:Panel ID="PanelGeneralSearch" runat="server" CssClass="headingPanel" TabIndex="-1"
BorderWidth="0" BorderStyle="None">
<asp:Label ID="HeadingLabel" runat="server" CssClass="headingLabel" TabIndex="-1"></asp:Label>
<table class="pageContainer">
<tr>
<td valign="top">
<uc1:SearchControl ID="SearchControl" runat="server" />
</td>
</tr>
</table>
</asp:Panel>
</form>
</body>
</html>
old code:
...
<script type="text/javascript">
function CheckKey() {
if (event.keyCode == 13) {
return false;
}
return true;
}
</script>
...
<body onkeydown="return CheckKey(event);" onload="hideLoading();">
I put the javascript in a RadCodeBlock and set the body's onkeydown event to call it. Now the form just keeps loading and never completes.
Here is the entire code (it isn't very large) The button is on a RadAjaxPanel in the referenced SearchControl.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="HeadSearch" runat="server">
<title>General Search</title>
...
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
function keyDown(e)
{
if(e.keyCode == 13)
{
var ajaxPanel = $find("<%= RadAjaxPanelSearch.ClientID %>");
var searchButton = $find("<%= ButtonSearch.ClientID %>");
searchButton.click();
}
}
</script>
</telerik:RadCodeBlock>
</head>
<body onkeydown="keyDown(event);" onload="hideLoading();">
<form id="FormSearch" runat="server">
<telerik:RadScriptManager ID="RadScriptManagerPage" runat="server" OnAsyncPostBackError="RadScriptManagerPage_AsyncPostBackError"
EnableScriptCombine="true" OutputCompression="AutoDetect" EnablePageMethods="true">
<Scripts>
<asp:ScriptReference Path="~/Scripts/M5.js" NotifyScriptLoaded="true" />
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
</Scripts>
</telerik:RadScriptManager>
<asp:Panel ID="PanelGeneralSearch" runat="server" CssClass="headingPanel" TabIndex="-1"
BorderWidth="0" BorderStyle="None">
<asp:Label ID="HeadingLabel" runat="server" CssClass="headingLabel" TabIndex="-1"></asp:Label>
<table class="pageContainer">
<tr>
<td valign="top">
<uc1:SearchControl ID="SearchControl" runat="server" />
</td>
</tr>
</table>
</asp:Panel>
</form>
</body>
</html>
old code:
...
<script type="text/javascript">
function CheckKey() {
if (event.keyCode == 13) {
return false;
}
return true;
}
</script>
...
<body onkeydown="return CheckKey(event);" onload="hideLoading();">