When I attempt to place a google search on my asp.net page the other buttons onclick events do not fire..
Here is my code.
<div
class="googleSearchBox" style="margin-left:150px">
Search by Keyword:
<asp:TextBox ID="qu" MaxLength="512" Width="250px" AutoPostBack="false" runat="server" /><asp:ImageButton ID="googlesearch" Text="Gun Show Search"
OnClick="googlesearch_Click" runat="server" />
<asp:RequiredFieldValidator ID="_rfvQ" ControlToValidate="qu" runat="server" />
<asp:HiddenField ID="cx" Value="008038850013659563853:gbg7oenu7bs" runat="server" />
<asp:HiddenField ID="cof" Value="FORID:10" runat="server" /></div>
<br />
<script type="text/javascript">function checkKey() {
if (window.event.keyCode == 13) // checks whether the ENTER key
// is pressed
{
window.event.cancelBubble = true;
window.event.returnValue =
false;var btnName = "_btnSearch";
var btn = document.getElementById(btnName);if (btn) btn.click();
}
}
1 protected void googlesearch_Click(Object sender, EventArgs e)
2 {
3 if (!IsValid)
4 return;
5
6 Response.Redirect(
7 String.Format(
8 "http://www.google.com/cse?q={0}&cx={1}&cof={2}",
9 HttpUtility.UrlEncode(SanitizeUserInput(qu.Text.Trim())),
10 HttpUtility.UrlEncode(cx.Value),
11 HttpUtility.UrlEncode(cof.Value)
12 ),
13 false
14 );
15
16 Context.ApplicationInstance.CompleteRequest();
17 }