AJAX Page Loading Failure on Some Browsers

Discussion in 'ASP .Net' started by Jacques Oberto, Oct 21, 2009.

  1. Hi All,

    Depending on the browser used (all latest versions), I am
    experiencing various degrees of failure in showing processing
    progress with a simple AJAX wait while loading" asp.net app.

    The app has two pages: Default.aspx (showing the progress)
    and a Process.aspx sleepy page doing some processing.

    Results (Vista SP2 & XP SP3):
    --IE8: works correctly only if DynamicLayout="False"
    --Safari4: works fine
    --Firefox3.5.3: spinning gif starts spinning then stops
    --Chrome3.0.195.27: works fine
    --Opera10: Fails miserably, no progresstemplate is shown at all

    I have been testing about a dozen similar projects from the
    web with the same results. I would be very pleased is someone
    could tell me what I am doing wrong.
    Thanks,

    Jacques



    Demo code follows:

    ============
    Default.aspx
    ============
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
    Inherits="_Default" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
    <title>UpdateProgress control</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <asp:UpdateProgress runat="server" id="PageUpdateProgress"
    EnableViewState="True" DynamicLayout="False">
    <ProgressTemplate>
    <div>
    Loading...
    <asp:Image ID="LoadingImage" runat="server"
    ImageUrl="~/loading.gif" />
    </div>
    </ProgressTemplate>
    </asp:UpdateProgress>
    <asp:UpdatePanel runat="server" id="Panel">
    <ContentTemplate>
    <asp:Button runat="server" id="UpdateButton"
    onclick="UpdateButton_Click" text="Update" />
    </ContentTemplate>
    </asp:UpdatePanel>
    </form>
    </body>
    </html>


    ===============
    Default.aspx.cs
    ===============
    ....
    protected void UpdateButton_Click(object sender, EventArgs e)
    {
    Response.Redirect("Progress.aspx");
    }


    ================
    Progress.aspx.cs
    ================
    ....
    protected void Page_Load(object sender, EventArgs e)
    {
    System.Threading.Thread.Sleep(5000);
    }
     
    Jacques Oberto, Oct 21, 2009
    #1
    1. Advertising

  2. Jacques Oberto

    bruce barker Guest

    your test is wrong.

    the updateprogress control is designed to run during an async (ajax)
    postback. the postback is returning right away with a redirect commend.
    the ajax code receives this, and sets the document.location to the new
    url (to do the redirect).

    at this point all bets are off, the browser is now navigating to a new
    page (that takes 5 seconds to respond). during navigation many browsers
    will stop the background thread that runs animated gifs, may ignore dom
    updates, etc. there is no defined behavior during this phase.

    if you are doing this on your local box, the redirect response may come
    before the progress bar even has chance to start.


    -- bruce (sqlwork.com)




    Jacques Oberto wrote:
    > Hi All,
    >
    > Depending on the browser used (all latest versions), I am
    > experiencing various degrees of failure in showing processing
    > progress with a simple AJAX wait while loading" asp.net app.
    >
    > The app has two pages: Default.aspx (showing the progress)
    > and a Process.aspx sleepy page doing some processing.
    >
    > Results (Vista SP2 & XP SP3):
    > --IE8: works correctly only if DynamicLayout="False"
    > --Safari4: works fine
    > --Firefox3.5.3: spinning gif starts spinning then stops
    > --Chrome3.0.195.27: works fine
    > --Opera10: Fails miserably, no progresstemplate is shown at all
    >
    > I have been testing about a dozen similar projects from the
    > web with the same results. I would be very pleased is someone
    > could tell me what I am doing wrong.
    > Thanks,
    >
    > Jacques
    >
    >
    >
    > Demo code follows:
    >
    > ============
    > Default.aspx
    > ============
    > <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
    > Inherits="_Default" %>
    > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    > "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    > <html xmlns="http://www.w3.org/1999/xhtml">
    > <head id="Head1" runat="server">
    > <title>UpdateProgress control</title>
    > </head>
    > <body>
    > <form id="form1" runat="server">
    > <asp:ScriptManager ID="ScriptManager1" runat="server" />
    > <asp:UpdateProgress runat="server" id="PageUpdateProgress"
    > EnableViewState="True" DynamicLayout="False">
    > <ProgressTemplate>
    > <div>
    > Loading...
    > <asp:Image ID="LoadingImage" runat="server"
    > ImageUrl="~/loading.gif" />
    > </div>
    > </ProgressTemplate>
    > </asp:UpdateProgress>
    > <asp:UpdatePanel runat="server" id="Panel">
    > <ContentTemplate>
    > <asp:Button runat="server" id="UpdateButton"
    > onclick="UpdateButton_Click" text="Update" />
    > </ContentTemplate>
    > </asp:UpdatePanel>
    > </form>
    > </body>
    > </html>
    >
    >
    > ===============
    > Default.aspx.cs
    > ===============
    > ...
    > protected void UpdateButton_Click(object sender, EventArgs e)
    > {
    > Response.Redirect("Progress.aspx");
    > }
    >
    >
    > ================
    > Progress.aspx.cs
    > ================
    > ...
    > protected void Page_Load(object sender, EventArgs e)
    > {
    > System.Threading.Thread.Sleep(5000);
    > }
     
    bruce barker, Oct 22, 2009
    #2
    1. Advertising

  3. > during navigation many browsers will stop the background thread that runs
    > animated gifs, may ignore dom updates, etc. there is no defined behavior
    > during this phase.


    Hi Bruce,

    Thanks for the explanation: I get it now.
    It is a bit scary that a wrong logic works perfectly in some browsers.
    This is certainly not helping newbie developers.

    Jacques
     
    Jacques Oberto, Oct 22, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ilias Lazaridis
    Replies:
    0
    Views:
    632
    Ilias Lazaridis
    Feb 1, 2005
  2. BBK
    Replies:
    4
    Views:
    373
    Anthony Buckland
    Oct 6, 2003
  3. El Kabong

    Browsers, browsers! Quo vadis?

    El Kabong, May 11, 2007, in forum: HTML
    Replies:
    23
    Views:
    952
    dorayme
    May 13, 2007
  4. Replies:
    0
    Views:
    524
  5. Graham J
    Replies:
    2
    Views:
    119
    Graham J
    Sep 20, 2003
Loading...

Share This Page