Have a real head-scratcher here: I have a page with several controls on it, and a ASP:Button or two. When I'm in a control, and hit the Enter key, it acts like I clicked the submit button, which I don't actually want to do at this point in time.
The button is not in a ASP:Panel with a DefaultButton set, it has no OnClientClick attribute, I can see no JavaScript that watches for the Enter key... Why is it firing?
If I create a standard .ASPX page and put a text box and a button on it, run it and hit the enter key, the button is ignored, e.g. the click event doesn't fire. This is the behaviour I expect, but am not getting.
In short, what else could cause a button to think it's the default button for the page?
Thank you,
Mike K.
Ok, here's my test page markup:
<p><asp:Label ID="uxNameL" runat="server" AssociatedControlID="uxName">Name</asp:Label><asp:TextBox ID="uxName" runat="server"></asp:TextBox></p>
<p><asp:Button id="uxSubmit" runat="server" Text="Submit" onclick="uxSubmit_Click" /></p>
<asp:Literal ID="uxOut" runat="server" EnableViewState="false"></asp:Literal>
Here's what happens in code:
protected void uxSubmit_Click(object sender, EventArgs e)
{
uxOut.Text = uxName.Text;
}
When I run the page, and enter some text in the textbox and press Enter - ha, would you look at that: In IE 8, the button event is ignored, e.g. the page just reloads, but in FF, it submits the form...
Hmmmmm.