AJAX Page Loading Failure on Some Browsers

J

Jacques Oberto

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);
}
 
B

bruce barker

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)
 
J

Jacques Oberto

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,781
Messages
2,569,615
Members
45,297
Latest member
EngineerD

Latest Threads

Top