ASP.NET Panel DefaultButton not working

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2009
Posts: 5
Reputation: jamesgurung is an unknown quantity at this point 
Solved Threads: 0
jamesgurung jamesgurung is offline Offline
Newbie Poster

ASP.NET Panel DefaultButton not working

 
0
  #1
Jul 7th, 2009
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?

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml">
  5. <head runat="server">
  6. <title>Test Page</title>
  7. <meta name="ROBOTS" content="NOINDEX" />
  8. </head>
  9. <body>
  10. <form id="form1" runat="server">
  11. <asp:Panel ID="Panel1" DefaultButton="Button1" runat="server">
  12. <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
  13. <asp:Button ID="Button1" runat="server" Text="Button1" onclick="Button1_Click" />
  14. </asp:Panel>
  15. <asp:Panel ID="Panel2" DefaultButton="Button2" runat="server">
  16. <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
  17. <asp:Button ID="Button2" runat="server" Text="Button2" onclick="Button2_Click" />
  18. </asp:Panel>
  19. <asp:Label ID="Label1" runat="server" Text="Label1"></asp:Label>
  20. </form>
  21. </body>
  22. </html>
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 446
Reputation: Ramesh S will become famous soon enough Ramesh S will become famous soon enough 
Solved Threads: 82
Ramesh S Ramesh S is offline Offline
Posting Pro in Training

Re: ASP.NET Panel DefaultButton not working

 
0
  #2
Jul 7th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 5
Reputation: jamesgurung is an unknown quantity at this point 
Solved Threads: 0
jamesgurung jamesgurung is offline Offline
Newbie Poster

Re: ASP.NET Panel DefaultButton not working

 
0
  #3
Jul 7th, 2009
Originally Posted by Ramesh S View Post
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?
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 446
Reputation: Ramesh S will become famous soon enough Ramesh S will become famous soon enough 
Solved Threads: 82
Ramesh S Ramesh S is offline Offline
Posting Pro in Training

Re: ASP.NET Panel DefaultButton not working

 
0
  #4
Jul 7th, 2009
This is the HTML source viewed in my IE8. The same is viewed in http://www.oxonacf.org.uk/test.aspx also.

  1.  
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head id="Head1"><title>
  5. Test Page
  6. </title><meta name="ROBOTS" content="NOINDEX" /></head>
  7. <body>
  8. <form name="form1" method="post" action="TestPage11.aspx" id="form1">
  9. <div>
  10. <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTA4OTU2ODYyMw9kFgICAw9kFgICBQ8PFgIeBFRleHQFK0J1dHRvbjFfQ2xpY2sgZmlyZWQgYXQgNy83LzIwMDkgMTA6MDQ6NDcgUE1kZGRpowb0CyldCDBRuX+q0ABj19Zgog==" />
  11. </div>
  12.  
  13. <div>
  14.  
  15. <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
  16. <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
  17. <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBQK/x8UUAuzRsusGAoznisYGAuzR9tkMArursYYI6vzYosbpPS4bH3+PLel4Gwkqpdo=" />
  18. </div>
  19. <div id="Panel1" onkeypress="javascript:return WebForm_FireDefaultButton(event, 'Button1')">
  20.  
  21. <input name="TextBox1" type="text" id="TextBox1" />
  22. <input type="submit" name="Button1" value="Button1" id="Button1" />
  23.  
  24. </div>
  25. <div id="Panel2" onkeypress="javascript:return WebForm_FireDefaultButton(event, 'Button2')">
  26.  
  27. <input name="TextBox2" type="text" id="TextBox2" />
  28. <input type="submit" name="Button2" value="Button2" id="Button2" />
  29.  
  30. </div>
  31. <span id="Label1">Button1_Click fired at 7/7/2009 10:04:47 PM</span>
  32.  
  33. <script type="text/javascript">
  34. //<![CDATA[
  35. var theForm = document.forms['form1'];
  36. if (!theForm) {
  37. theForm = document.form1;
  38. }
  39. function __doPostBack(eventTarget, eventArgument) {
  40. if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
  41. theForm.__EVENTTARGET.value = eventTarget;
  42. theForm.__EVENTARGUMENT.value = eventArgument;
  43. theForm.submit();
  44. }
  45. }
  46. //]]>
  47. </script>
  48.  
  49.  
  50. <script src="/Site3/WebResource.axd?d=a89fGCglRfUbEVx19IXx7g2&amp;t=633658105131718750" type="text/javascript"></script>
  51. </form>
  52. </body>
  53. </html>
Last edited by Ramesh S; Jul 7th, 2009 at 1:36 pm.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 5
Reputation: jamesgurung is an unknown quantity at this point 
Solved Threads: 0
jamesgurung jamesgurung is offline Offline
Newbie Poster

Re: ASP.NET Panel DefaultButton not working

 
0
  #5
Jul 7th, 2009
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?
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 5
Reputation: jamesgurung is an unknown quantity at this point 
Solved Threads: 0
jamesgurung jamesgurung is offline Offline
Newbie Poster

Re: ASP.NET Panel DefaultButton not working

 
0
  #6
Jul 7th, 2009
Okay, I've solved this. It was the bug with trying to gzip WebResource.axd. Thanks for pointing me in the right direction.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the ASP.NET Forum
Thread Tools Search this Thread



Tag cloud for ASP.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC