N
nkoier
Hi, I've been going crazy trying to figure out what's wrong with our
Asp.Net 2.0 intranet site.
At the very top of our main page I provide a TextBox and a Button for
submitting Google searches. Recently somebody pointed out to me that
you can't just press ENTER anymore after typing in the TextBox but
that you HAVE to click on the submit Button WITH THE MOUSE for it to
work. After some initial troubleshooting I discovered that it's only
an issue in IE 6 & 7 (works fine in FireFox!).
To simplify I created a brand new empty web form. I dropped an
<asp:TextBox/> & <asp:Button/> control on the the page (even made sure
they had the same ValidationGroup="google") and then wired up the
Button's click event.
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("http://www.google.com/search?q=" +
TextBox1.Text);
}
If you click the submit Button using the mouse the Response.Redirect
works fine. If you press ENTER on the keyboard while the focus is
still in the TextBox it does not work (the page just flashes/posts
back).
Let me clarify that the code in the Button1_Click event handler DOES
execute in both situations. Meaning if I put a breakpoint on the
Response.Redirect line and then run the debugger; when I type some
text into the TextBox and press ENTER on the keyboard the breakpoint
DOES get hit. When I step-out however, the page just refreshes and is
still sitting there. It's like the code is actually running ok and the
redirect is being sent to the client, but IE is then stopping it from
happening at the client-side somehow!? Alternatively, if I type into
the TextBox then do a SHIFT+TAB to put the focus on the submit button
itself, THEN pressing ENTER works.
How can I make it so that someone can type some text into a TextBox
and then just press ENTER on the keyboard? Anybody have any ideas?
Please?
Thanks in advance,
-Nick
Asp.Net 2.0 intranet site.
At the very top of our main page I provide a TextBox and a Button for
submitting Google searches. Recently somebody pointed out to me that
you can't just press ENTER anymore after typing in the TextBox but
that you HAVE to click on the submit Button WITH THE MOUSE for it to
work. After some initial troubleshooting I discovered that it's only
an issue in IE 6 & 7 (works fine in FireFox!).
To simplify I created a brand new empty web form. I dropped an
<asp:TextBox/> & <asp:Button/> control on the the page (even made sure
they had the same ValidationGroup="google") and then wired up the
Button's click event.
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("http://www.google.com/search?q=" +
TextBox1.Text);
}
If you click the submit Button using the mouse the Response.Redirect
works fine. If you press ENTER on the keyboard while the focus is
still in the TextBox it does not work (the page just flashes/posts
back).
Let me clarify that the code in the Button1_Click event handler DOES
execute in both situations. Meaning if I put a breakpoint on the
Response.Redirect line and then run the debugger; when I type some
text into the TextBox and press ENTER on the keyboard the breakpoint
DOES get hit. When I step-out however, the page just refreshes and is
still sitting there. It's like the code is actually running ok and the
redirect is being sent to the client, but IE is then stopping it from
happening at the client-side somehow!? Alternatively, if I type into
the TextBox then do a SHIFT+TAB to put the focus on the submit button
itself, THEN pressing ENTER works.
How can I make it so that someone can type some text into a TextBox
and then just press ENTER on the keyboard? Anybody have any ideas?
Please?
Thanks in advance,
-Nick