asp:Panel's DefaultButton inside asp:UpdatePanel in FireFox

Last post 08-14-2007 12:35 PM by oshadha. 5 replies.

Sort Posts:

  • asp:Panel's DefaultButton inside asp:UpdatePanel in FireFox

    05-12-2007, 6:11 PM
    • Loading...
    • roncli
    • Joined on 11-19-2005, 12:19 AM
    • Posts 7

    I'm having a bit of an issue with the DefaultButton in FireFox... consider the following simple code:

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Test.aspx.vb" 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</title>
    </head>
    <body>
        <form id="frmMain" runat="server">
        <asp:ScriptManager ID="smManager" runat="server" />
        <div>
    <%--        <asp:UpdatePanel ID="updTest" runat="server">
                <ContentTemplate>
    --%>                <asp:Panel ID="pnl1" runat="server" DefaultButton="btn1">
                        This is panel 1.
                        <asp:TextBox ID="txt1" runat="server" />
                        <asp:Button ID="btn1" runat="server" Text="Go to panel 2" OnClick="btn1_Click" />
                    </asp:Panel>
                    <asp:Panel ID="pnl2" runat="server" DefaultButton="btn2" Visible="False">
                        This is panel 2.
                        <asp:TextBox ID="txt2" runat="server" />
                        <asp:Button ID="btn2" runat="server" Text="Go to panel 1" />
                    </asp:Panel>
    <%--            </ContentTemplate>
            </asp:UpdatePanel>
    --%>    </div>
        </form>
    </body>
    </html>
    

    as well as the following code behind:

    Partial Class Test
        Inherits System.Web.UI.Page
    
        Protected Sub btn1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn1.Click
            pnl1.Visible = False
            pnl2.Visible = True
        End Sub
    
        Protected Sub btn2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn2.Click
            pnl1.Visible = True
            pnl2.Visible = False
        End Sub
    End Class
    

    As this is written, it works 100% fine in both IE and FireFox.  However, if you uncomment out the code in the first script above, it will work fine in IE, but FireFox just does a plain postback to the UpdatePanel, and it doesn't seem to be generating the click event.

    Any ideas how to solve this?

  • Re: asp:Panel's DefaultButton inside asp:UpdatePanel in FireFox

    05-13-2007, 4:42 AM
    Answer
    • Loading...
    • WishStar99
    • Joined on 08-05-2006, 12:11 AM
    • VietNam
    • Posts 549
    set UseSubmitbahavior=false to the button then it will work.
    Aeries' Coders
    Programmers' Forums at Advance Microtech


    Nothing is impossible when it comes to coding.
  • Re: asp:Panel's DefaultButton inside asp:UpdatePanel in FireFox

    05-14-2007, 3:35 PM
    • Loading...
    • roncli
    • Joined on 11-19-2005, 12:19 AM
    • Posts 7
    UseSubmitBehavior="False" worked like a charm!  Thanks!!
  • Re: asp:Panel's DefaultButton inside asp:UpdatePanel in FireFox

    06-18-2007, 9:45 AM
    • Loading...
    • freedumb87
    • Joined on 05-16-2007, 9:00 PM
    • Posts 21

    What do you do to get it to work in firefox if you are using imagebuttons?

  • Re: asp:Panel's DefaultButton inside asp:UpdatePanel in FireFox

    06-21-2007, 11:01 AM
    • Loading...
    • gdogg
    • Joined on 03-15-2006, 9:02 PM
    • Posts 39

    roncli:
    UseSubmitBehavior="False" worked like a charm!  Thanks!!

     Could you post the exact fix?  The above posted website is down for construction.

  • Re: asp:Panel's DefaultButton inside asp:UpdatePanel in FireFox

    08-14-2007, 12:35 PM
    • Loading...
    • oshadha
    • Joined on 05-26-2007, 1:33 PM
    • Posts 1

    Ur solution is working well. But there is another issue. Think of a situation that it has a multiline text box. If u try to hit the enter key to get a new line. It won't work in FireFox. Will there be a solution for that? Sad

Page 1 of 1 (6 items)
Microsoft Communities
Page view counter