On this test page I intend that if you press the Enter key with focus in TextBox1, Button1_Click will fire, whereas in TextBox2, Button2_Click will fire. This is not working in IE8 or FF3.5. Any ideas?

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %>

<!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 runat="server">
  <title>Test Page</title>
  <meta name="ROBOTS" content="NOINDEX" />
</head>
<body>
  <form id="form1" runat="server">
  <asp:Panel ID="Panel1" DefaultButton="Button1" runat="server">
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="Button1" onclick="Button1_Click" />
  </asp:Panel>
  <asp:Panel ID="Panel2" DefaultButton="Button2" runat="server">
    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
    <asp:Button ID="Button2" runat="server" Text="Button2" onclick="Button2_Click" />
  </asp:Panel>
  <asp:Label ID="Label1" runat="server" Text="Label1"></asp:Label>
  </form>
</body>
</html>

I have tested your code in IE8 and Opera. It is working fine.

But it is not working if URL in your question is viewed in IE8 and opera. Also both browsers re emitted with proper HTML.

Sorry. I could n't find the problem.

I have tested your code in IE8 and Opera. It is working fine.

But it is not working if URL in your question is viewed in IE8 and opera. Also both browsers re emitted with proper HTML.

Sorry. I could n't find the problem.

Thanks for looking into this. Could you send me a link to the page that works, or paste its HTML output and HTTP headers here?

This is the HTML source viewed in my IE8. The same is viewed in http://www.oxonacf.org.uk/test.aspx also.

<!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="Head1"><title>
	Test Page
</title><meta name="ROBOTS" content="NOINDEX" /></head>
<body>
  <form name="form1" method="post" action="TestPage11.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTA4OTU2ODYyMw9kFgICAw9kFgICBQ8PFgIeBFRleHQFK0J1dHRvbjFfQ2xpY2sgZmlyZWQgYXQgNy83LzIwMDkgMTA6MDQ6NDcgUE1kZGRpowb0CyldCDBRuX+q0ABj19Zgog==" />
</div>
 
<div>
 
	<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
	<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
	<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBQK/x8UUAuzRsusGAoznisYGAuzR9tkMArursYYI6vzYosbpPS4bH3+PLel4Gwkqpdo=" />
</div>
  <div id="Panel1" onkeypress="javascript:return WebForm_FireDefaultButton(event, 'Button1')">
	
    <input name="TextBox1" type="text" id="TextBox1" />
    <input type="submit" name="Button1" value="Button1" id="Button1" />
  
</div>
  <div id="Panel2" onkeypress="javascript:return WebForm_FireDefaultButton(event, 'Button2')">
	
    <input name="TextBox2" type="text" id="TextBox2" />
    <input type="submit" name="Button2" value="Button2" id="Button2" />
  
</div>
  <span id="Label1">Button1_Click fired at 7/7/2009 10:04:47 PM</span>
  
<script type="text/javascript"> 
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
    theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script>
 
 
<script src="/Site3/WebResource.axd?d=a89fGCglRfUbEVx19IXx7g2&amp;t=633658105131718750" type="text/javascript"></script>
</form>
</body>
</html>

Oh damn I've got it, and it's not good. Since implementing ASP.NET Routing the application is no longer returning requests for WebResource.axd.

I've got routes.Add(new Route("{resource}.axd/{*pathInfo}", new StopRoutingHandler())); in Application_Start but it's not doing the trick. And an error is thrown if I remove the trailing slash after .axd.

Any ideas?

Okay, I've solved this. It was the bug with trying to gzip WebResource.axd. Thanks for pointing me in the right direction. :)

This article has been dead for over six months. Start a new discussion instead.