views:

285

answers:

0

In Firefox (3.5 or 3.0), AJAX toolkit modal popups move just before a redirect. It's as if the positioning css is ignored. The rest of the css appears to be honoured i.e. the popup appearance doesn't change but it jumps to the top left-hand corner.

The test code below reproduces the issue. It only happens in Firefox. I am going to try to work around it by implementing client-side-popup-hiding measures but I would still like to know why it is happening.

MARKUP

<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="scriptManager" runat="server" />
        <div>

            <asp:LinkButton runat="server" ID="buttonShowPopup" Text="Show Popup"></asp:LinkButton>

            <asp:Button runat="server" ID="buttonPopupController" style="display:none"  />  
            <ajaxToolkit:ModalPopupExtender 
                runat="server" 
                ID="popup" 
                PopupControlID="panel" 
                TargetControlID="buttonPopupController"
                DropShadow="True"
                BackgroundCssClass="modalBackground"
                >
            </ajaxToolkit:ModalPopupExtender>        
            <asp:Panel runat="server" ID="panel" Style="display: none" CssClass="modalPopup">
                <asp:UpdatePanel runat="server" ID="updatePanel">
                    <ContentTemplate>
                        <asp:Label runat="server" Text="This is my popup."/>
                        <br /><br />
                        <asp:Button runat="server" ID="buttonRedirect" Text="Redirect" />
                    </ContentTemplate>
                </asp:UpdatePanel>
            </asp:Panel>    

        </div>
    </form>
</body>
</html>

CODE BEHIND

using System;
using System.Threading;

namespace Test.RedirectIssue
{
    public partial class MyTestPage : System.Web.UI.Page
    {
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            this.buttonShowPopup.Click += new EventHandler(buttonShowPopup_Click);
            this.buttonRedirect.Click += new EventHandler(buttonRedirect_Click);
        }

        private void buttonRedirect_Click(object sender, EventArgs e)
        {
            Thread.Sleep(5000);
            this.Response.Redirect("http://www.google.com");
        }

        private void buttonShowPopup_Click(object sender, EventArgs e)
        {
            this.popup.Show();
        }
    }
}