473,378 Members | 1,138 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Defaultbutton handling misbehaving in firefox after hitting back button

Hi all,

I've stumbled on an interesting problem with the way Firefox handles
form submitting with the enter key.

I'm putting together a page that has one form element with multiple
controls with their own textbox field and submit imagebuttons. I've
set up each control in an asp:Panel with their DefaultButton property
set to the proper button, so when the enter key is pressed, the proper
button event handler is triggered. This works in every case EXCEPT
when i submit the form in firefox, hit the back button, and hit enter
in the second text box. Firefox never calls the
WebForm_FireDefaultButton handler, and the server responds as though
the other button was clicked.

I'm thinking this has to do with the page caching that firefox
introduced with 1.5, but I have no clue how to work around this. Any
suggestions? Has anyone else seen this behavior?

Aug 11 '06 #1
1 2072
Here's a simple example:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs"
Inherits="test" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
<form id="form1" runat="server">
<div>
<asp:Panel ID="Panel1" runat="server"
DefaultButton="testButton1">
<asp:TextBox ID="TextBox1" runat="server" MaxLength="10" />
<asp:Button ID="testButton1" Text="Button 1" runat="server"
OnClick="testButton1_Click" />
</asp:Panel>
<asp:Panel ID="testPanel" runat="server"
DefaultButton="testButton2">
<asp:TextBox ID="testTextBox" runat="server" MaxLength="10"
/>
<asp:Button ID="testButton2" Text="Button 2" runat="server"
OnClick="testButton2_Click" />
</asp:Panel>
<asp:Label ID="Label1" runat="server" />
</div>
</form>
</body>
</html>

Codebehind:
public partial class test : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {

}
protected void testButton1_Click(object sender, EventArgs e) {
this.Label1.Text = "Button 1 Clicked";
}
protected void testButton2_Click(object sender, EventArgs e) {
this.Label1.Text = "Button 2 Clicked";
}
}

gf******@gmail.com wrote:
Hi all,

I've stumbled on an interesting problem with the way Firefox handles
form submitting with the enter key.

I'm putting together a page that has one form element with multiple
controls with their own textbox field and submit imagebuttons. I've
set up each control in an asp:Panel with their DefaultButton property
set to the proper button, so when the enter key is pressed, the proper
button event handler is triggered. This works in every case EXCEPT
when i submit the form in firefox, hit the back button, and hit enter
in the second text box. Firefox never calls the
WebForm_FireDefaultButton handler, and the server responds as though
the other button was clicked.

I'm thinking this has to do with the page caching that firefox
introduced with 1.5, but I have no clue how to work around this. Any
suggestions? Has anyone else seen this behavior?
Aug 11 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dpomt | last post by:
I am facing some issues with the webforms DefaultButton functionality: #1 One text box ==> hitting enter works in IE but not in Firefox (1.5) #2 One text box and req. field validator ==> problem...
5
by: Tyler Carver | last post by:
I have found a situation where the DefaultButton and DefaultFocus stop working under FireFox. I'm looking for any kind of fix or work around. The problem seems to happen when setting a control...
0
by: Jeff | last post by:
We have 3 environments, Dev, Qa, Prod. I'm working on an application that has a search page. On the search page is 3 panels. One panel is the advanced search, another a normal search and the...
2
by: Oz Kologlu | last post by:
Hi folks, IE and Asp.net 2.0 are doing some pretty bizzare things. Some of our users were getting pretty weary of IE redrawing and "flashing" what is essentially a pretty static page every time...
7
by: Tim_Mac | last post by:
this is a re-post of an earlier message. i'm posting it under my MSDN alias for a better chance of reply :) when you press return in a multiline textbox, you expect to insert a newline. ...
2
by: =?Utf-8?B?QmlnSm9obg==?= | last post by:
We can set the default button and focus field in ASP.Net 2.0 on the Form tag. My form tag is in the Master page, but the controls are in containers. I read through a few articles which did not...
4
by: Tim Mackey | last post by:
hi, asp.net 2. can anyone explain why this code does not work in firefox (2.0.0.1), but does work in IE 7. if you hit enter after typing something into the textbox, it should fire the Submit...
1
by: koraykazgan | last post by:
Hi all, I have a user control (ASCX). In that user control there is a panel, and inside that panel there is a textbox and a button. The panel has a DefaultButton property set, which is set to the...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.