Please Wait

Discussion in 'ASP .Net' started by mw, Oct 15, 2004.

  1. mw

    mw Guest

    I'm writing an application that's going to do alot of processing while the
    user is waiting, (imagine sitting and waiting while the server/background
    processing is occurring). What's the best way to entertain the user (e.g.
    show them something's happening - e.g. animated gif progress bar or
    something) and then automatically show the "done" page when the processing
    is finished.

    Thanks!
     
    mw, Oct 15, 2004
    #1
    1. Advertising

  2. Check out this recent article

    http://msdn.microsoft.com/msdnmag/issues/04/10/AdvancedBasics/default.aspx

    "mw" wrote:

    > I'm writing an application that's going to do alot of processing while the
    > user is waiting, (imagine sitting and waiting while the server/background
    > processing is occurring). What's the best way to entertain the user (e.g.
    > show them something's happening - e.g. animated gif progress bar or
    > something) and then automatically show the "done" page when the processing
    > is finished.
    >
    > Thanks!
    >
    >
    >
     
    =?Utf-8?B?QnJhZCBSb2JlcnRz?=, Oct 15, 2004
    #2
    1. Advertising

  3. mw

    Sahil Malik Guest

    Maybe you want to look into delegating that task to another process, and the
    page refreshes itself every few seconds to show the end user a progress bar
    or something like that. Long running processes that are oltp based are
    always clumsy in Asp.net :-/
    That'll keep them busy, but If you really wanna entertain them, maybe you
    could show them a blonde joke at every page refresh (just kidding).

    - Sahil Malik
    You can reach me thru my blog http://www.dotnetjunkies.com/weblog/sahilmalik



    "mw" <> wrote in message
    news:ZGJbd.90465$a85.38249@fed1read04...
    > I'm writing an application that's going to do alot of processing while the
    > user is waiting, (imagine sitting and waiting while the server/background
    > processing is occurring). What's the best way to entertain the user (e.g.
    > show them something's happening - e.g. animated gif progress bar or
    > something) and then automatically show the "done" page when the processing
    > is finished.
    >
    > Thanks!
    >
    >
     
    Sahil Malik, Oct 15, 2004
    #3
  4. Hi

    How does Duncan's code help in a Web Forms situation? Someone clicks submit
    on a form or something, the asp does the code behind for the next page (which
    does whatever they submitted it to do). How does the progress bar fit in?

    dan


    "mw" wrote:

    > I'm writing an application that's going to do alot of processing while the
    > user is waiting, (imagine sitting and waiting while the server/background
    > processing is occurring). What's the best way to entertain the user (e.g.
    > show them something's happening - e.g. animated gif progress bar or
    > something) and then automatically show the "done" page when the processing
    > is finished.
    >
    > Thanks!
    >
    >
    >
     
    =?Utf-8?B?RGFuIE5hc2g=?=, Oct 15, 2004
    #4
  5. My apologies. The article I referenced was not the one I intended. (So many
    ideas...) I have used the included aspx page to display a progress bar while
    another aspx page is performing a long-running process to collect report
    data. This page is started by calling it with the name of the long-running
    page in the QueryString.



    <%@ Page Language="vb" AutoEventWireup="false"
    Codebehind="PleaseWait.aspx.vb" Inherits="BRS_Vouchers.PleaseWait"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <title>PleaseWait</title>
    <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
    <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
    <meta content="JavaScript" name="vs_defaultClientScript">
    <meta content="http://schemas.microsoft.com/intellisense/ie5"
    name="vs_targetSchema">
    <META http-equiv=Refresh
    content='3; URL=<% =(Request.QueryString("TargetPage") & "?x=" &
    DateTime.Now.ToString("ddMMMyyyyHmmss")) %>'>
    <SCRIPT language="javascript">
    var i = 0;
    function ProgressBar(secondsForWaiting, minutesForWaiting)
    {
    if (secondsForWaiting.valueOf() > 0)
    {
    d3.innerText = "This process can take up to "
    + secondsForWaiting + " seconds...";
    timedIterations(secondsForWaiting);
    }
    else
    {
    if (minutesForWaiting.valueOf() > 0)
    {
    d3.innerText =
    "This process can take up to "
    + minutesForWaiting + " minutes...";
    timedIterations(minutesForWaiting * 60);
    }
    }
    }

    function timedIterations(secondsForIterating)
    {
    incrementalWidth = 800 / secondsForIterating;
    if (i <= secondsForIterating + 10)
    {
    d1.innerText="Elapsed time: " + i + " seconds.";
    d2.style.width=i*incrementalWidth;
    setTimeout("timedIterations(" + secondsForIterating + ");", 1000);
    i++;
    }
    else
    {
    d1.style.visibility = "hidden";
    d2.style.visibility = "hidden";
    d3.innerText =
    "The server is taking longer than "
    + "anticipated to process your request. "
    + "Thank you for your patience. "
    }
    }
    </SCRIPT>
    </HEAD>
    <body bgColor="#96b0be" topMargin="0" onload="ProgressBar(60,0);"
    MS_POSITIONING="FlowLayout">
    <TABLE id="Table1" style="WIDTH: 100%; HEIGHT: 65px" borderColor="#000000"
    cellSpacing="0"
    cellPadding="1" border="0">
    <TR>
    <TD style="HEIGHT: 65px" vAlign="bottom" align="center"
    bgColor="black"></TD>
    <TD style="WIDTH: 797px; HEIGHT: 65px" vAlign="bottom" align="center"
    width="797" background="images/BRS_Title.jpg"
    colSpan="1" rowSpan="1">
    <P><asp:label id="PageHeaderLabel" runat="server" Font-Names="Arial"
    Font-Size="Medium" BorderStyle="None"
    Font-Bold="True" ForeColor="#ffffff"></asp:label></P>
    </TD>
    <TD style="HEIGHT: 65px" vAlign="bottom" align="center"
    bgColor="#000000"></TD>
    </TR>
    </TABLE>
    <form id="Form1" method="post" runat="server">
    <TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
    <TR>
    <TD align="center" width="100%"><font size="6">
    <P><b>Please Wait
    <br>
    Processing for the report...</b></P>
    </font>
    <P><b><asp:label id="StartTimeLabel" runat="server"
    EnableViewState="False" Font-Names="Arial" Font-Size="Large"
    BorderStyle="None"></asp:label></b></P>
    <font size="4">
    <P>This report is in a new browser window.<br>
    Please close this window as soon as you are finished with the report.
    </P>
    </font>
    </TD>
    </TR>
    <tr>
    <td align="center" width="100%"><font size="4">
    <div id="d1" style="FONT-WEIGHT: bold; FONT-FAMILY: Arial"></div>
    </font>
    <div id="d2" style="BACKGROUND-COLOR: red"></div>
    <font size="4">
    <div id="d3" style="FONT-WEIGHT: bold; FONT-FAMILY: Arial"></div>
    </font>
    </td>
    </tr>
    </TABLE>
    </form>
    </body>
    </HTML>
     
    =?Utf-8?B?QnJhZCBSb2JlcnRz?=, Oct 15, 2004
    #5
  6. Hi Brad,

    Cool.

    2 things though...

    Is there anything in the CodeBehind file we should know about? And whats
    BRS_Vouchers.PleaseWait - is that something that's included or a component or
    what?

    Cheers :)

    Dan


    "Brad Roberts" wrote:

    > My apologies. The article I referenced was not the one I intended. (So many
    > ideas...) I have used the included aspx page to display a progress bar while
    > another aspx page is performing a long-running process to collect report
    > data. This page is started by calling it with the name of the long-running
    > page in the QueryString.
    >
    >
    >
    > <%@ Page Language="vb" AutoEventWireup="false"
    > Codebehind="PleaseWait.aspx.vb" Inherits="BRS_Vouchers.PleaseWait"%>
    > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    > <HTML>
    > <HEAD>
    > <title>PleaseWait</title>
    > <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
    > <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
    > <meta content="JavaScript" name="vs_defaultClientScript">
    > <meta content="http://schemas.microsoft.com/intellisense/ie5"
    > name="vs_targetSchema">
    > <META http-equiv=Refresh
    > content='3; URL=<% =(Request.QueryString("TargetPage") & "?x=" &
    > DateTime.Now.ToString("ddMMMyyyyHmmss")) %>'>
    > <SCRIPT language="javascript">
    > var i = 0;
    > function ProgressBar(secondsForWaiting, minutesForWaiting)
    > {
    > if (secondsForWaiting.valueOf() > 0)
    > {
    > d3.innerText = "This process can take up to "
    > + secondsForWaiting + " seconds...";
    > timedIterations(secondsForWaiting);
    > }
    > else
    > {
    > if (minutesForWaiting.valueOf() > 0)
    > {
    > d3.innerText =
    > "This process can take up to "
    > + minutesForWaiting + " minutes...";
    > timedIterations(minutesForWaiting * 60);
    > }
    > }
    > }
    >
    > function timedIterations(secondsForIterating)
    > {
    > incrementalWidth = 800 / secondsForIterating;
    > if (i <= secondsForIterating + 10)
    > {
    > d1.innerText="Elapsed time: " + i + " seconds.";
    > d2.style.width=i*incrementalWidth;
    > setTimeout("timedIterations(" + secondsForIterating + ");", 1000);
    > i++;
    > }
    > else
    > {
    > d1.style.visibility = "hidden";
    > d2.style.visibility = "hidden";
    > d3.innerText =
    > "The server is taking longer than "
    > + "anticipated to process your request. "
    > + "Thank you for your patience. "
    > }
    > }
    > </SCRIPT>
    > </HEAD>
    > <body bgColor="#96b0be" topMargin="0" onload="ProgressBar(60,0);"
    > MS_POSITIONING="FlowLayout">
    > <TABLE id="Table1" style="WIDTH: 100%; HEIGHT: 65px" borderColor="#000000"
    > cellSpacing="0"
    > cellPadding="1" border="0">
    > <TR>
    > <TD style="HEIGHT: 65px" vAlign="bottom" align="center"
    > bgColor="black"></TD>
    > <TD style="WIDTH: 797px; HEIGHT: 65px" vAlign="bottom" align="center"
    > width="797" background="images/BRS_Title.jpg"
    > colSpan="1" rowSpan="1">
    > <P><asp:label id="PageHeaderLabel" runat="server" Font-Names="Arial"
    > Font-Size="Medium" BorderStyle="None"
    > Font-Bold="True" ForeColor="#ffffff"></asp:label></P>
    > </TD>
    > <TD style="HEIGHT: 65px" vAlign="bottom" align="center"
    > bgColor="#000000"></TD>
    > </TR>
    > </TABLE>
    > <form id="Form1" method="post" runat="server">
    > <TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
    > <TR>
    > <TD align="center" width="100%"><font size="6">
    > <P><b>Please Wait
    > <br>
    > Processing for the report...</b></P>
    > </font>
    > <P><b><asp:label id="StartTimeLabel" runat="server"
    > EnableViewState="False" Font-Names="Arial" Font-Size="Large"
    > BorderStyle="None"></asp:label></b></P>
    > <font size="4">
    > <P>This report is in a new browser window.<br>
    > Please close this window as soon as you are finished with the report.
    > </P>
    > </font>
    > </TD>
    > </TR>
    > <tr>
    > <td align="center" width="100%"><font size="4">
    > <div id="d1" style="FONT-WEIGHT: bold; FONT-FAMILY: Arial"></div>
    > </font>
    > <div id="d2" style="BACKGROUND-COLOR: red"></div>
    > <font size="4">
    > <div id="d3" style="FONT-WEIGHT: bold; FONT-FAMILY: Arial"></div>
    > </font>
    > </td>
    > </tr>
    > </TABLE>
    > </form>
    > </body>
    > </HTML>
    >
     
    =?Utf-8?B?RGFuIE5hc2g=?=, Oct 15, 2004
    #6
  7. 1) The only thing in the code behind is one line of code to populate a label
    on the page with the current time.

    2) I probably should have just left that line out. That is just the
    reference to the code-behind page. The name of the page in my code is
    "PleaseWait.aspx".

    "Dan Nash" wrote:

    > Hi Brad,
    >
    > Cool.
    >
    > 2 things though...
    >
    > Is there anything in the CodeBehind file we should know about? And whats
    > BRS_Vouchers.PleaseWait - is that something that's included or a component or
    > what?
    >
    > Cheers :)
    >
    > Dan
    >
    >
    > "Brad Roberts" wrote:
    >
    > > My apologies. The article I referenced was not the one I intended. (So many
    > > ideas...) I have used the included aspx page to display a progress bar while
    > > another aspx page is performing a long-running process to collect report
    > > data. This page is started by calling it with the name of the long-running
    > > page in the QueryString.
    > >
    > >
    > >
    > > <%@ Page Language="vb" AutoEventWireup="false"
    > > Codebehind="PleaseWait.aspx.vb" Inherits="BRS_Vouchers.PleaseWait"%>
    > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    > > <HTML>
    > > <HEAD>
    > > <title>PleaseWait</title>
    > > <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
    > > <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
    > > <meta content="JavaScript" name="vs_defaultClientScript">
    > > <meta content="http://schemas.microsoft.com/intellisense/ie5"
    > > name="vs_targetSchema">
    > > <META http-equiv=Refresh
    > > content='3; URL=<% =(Request.QueryString("TargetPage") & "?x=" &
    > > DateTime.Now.ToString("ddMMMyyyyHmmss")) %>'>
    > > <SCRIPT language="javascript">
    > > var i = 0;
    > > function ProgressBar(secondsForWaiting, minutesForWaiting)
    > > {
    > > if (secondsForWaiting.valueOf() > 0)
    > > {
    > > d3.innerText = "This process can take up to "
    > > + secondsForWaiting + " seconds...";
    > > timedIterations(secondsForWaiting);
    > > }
    > > else
    > > {
    > > if (minutesForWaiting.valueOf() > 0)
    > > {
    > > d3.innerText =
    > > "This process can take up to "
    > > + minutesForWaiting + " minutes...";
    > > timedIterations(minutesForWaiting * 60);
    > > }
    > > }
    > > }
    > >
    > > function timedIterations(secondsForIterating)
    > > {
    > > incrementalWidth = 800 / secondsForIterating;
    > > if (i <= secondsForIterating + 10)
    > > {
    > > d1.innerText="Elapsed time: " + i + " seconds.";
    > > d2.style.width=i*incrementalWidth;
    > > setTimeout("timedIterations(" + secondsForIterating + ");", 1000);
    > > i++;
    > > }
    > > else
    > > {
    > > d1.style.visibility = "hidden";
    > > d2.style.visibility = "hidden";
    > > d3.innerText =
    > > "The server is taking longer than "
    > > + "anticipated to process your request. "
    > > + "Thank you for your patience. "
    > > }
    > > }
    > > </SCRIPT>
    > > </HEAD>
    > > <body bgColor="#96b0be" topMargin="0" onload="ProgressBar(60,0);"
    > > MS_POSITIONING="FlowLayout">
    > > <TABLE id="Table1" style="WIDTH: 100%; HEIGHT: 65px" borderColor="#000000"
    > > cellSpacing="0"
    > > cellPadding="1" border="0">
    > > <TR>
    > > <TD style="HEIGHT: 65px" vAlign="bottom" align="center"
    > > bgColor="black"></TD>
    > > <TD style="WIDTH: 797px; HEIGHT: 65px" vAlign="bottom" align="center"
    > > width="797" background="images/BRS_Title.jpg"
    > > colSpan="1" rowSpan="1">
    > > <P><asp:label id="PageHeaderLabel" runat="server" Font-Names="Arial"
    > > Font-Size="Medium" BorderStyle="None"
    > > Font-Bold="True" ForeColor="#ffffff"></asp:label></P>
    > > </TD>
    > > <TD style="HEIGHT: 65px" vAlign="bottom" align="center"
    > > bgColor="#000000"></TD>
    > > </TR>
    > > </TABLE>
    > > <form id="Form1" method="post" runat="server">
    > > <TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
    > > <TR>
    > > <TD align="center" width="100%"><font size="6">
    > > <P><b>Please Wait
    > > <br>
    > > Processing for the report...</b></P>
    > > </font>
    > > <P><b><asp:label id="StartTimeLabel" runat="server"
    > > EnableViewState="False" Font-Names="Arial" Font-Size="Large"
    > > BorderStyle="None"></asp:label></b></P>
    > > <font size="4">
    > > <P>This report is in a new browser window.<br>
    > > Please close this window as soon as you are finished with the report.
    > > </P>
    > > </font>
    > > </TD>
    > > </TR>
    > > <tr>
    > > <td align="center" width="100%"><font size="4">
    > > <div id="d1" style="FONT-WEIGHT: bold; FONT-FAMILY: Arial"></div>
    > > </font>
    > > <div id="d2" style="BACKGROUND-COLOR: red"></div>
    > > <font size="4">
    > > <div id="d3" style="FONT-WEIGHT: bold; FONT-FAMILY: Arial"></div>
    > > </font>
    > > </td>
    > > </tr>
    > > </TABLE>
    > > </form>
    > > </body>
    > > </HTML>
    > >
     
    =?Utf-8?B?QnJhZCBSb2JlcnRz?=, Oct 15, 2004
    #7
  8. mw

    Alex Homer Guest

    Here's a few ideas, with [view source] links and you can downlod the code:
    http://www.daveandal.net/books/6744/samples.aspx

    a.. Chapter 3 - Loading Progress and Status Displays
    a.. Displaying a "Please Wait" Message
    a.. Displaying a "Progress Bar" Graphic
    a.. Displaying Staged Page Load Progress


    "mw" <> wrote in message
    news:ZGJbd.90465$a85.38249@fed1read04...
    > I'm writing an application that's going to do alot of processing while the
    > user is waiting, (imagine sitting and waiting while the server/background
    > processing is occurring). What's the best way to entertain the user (e.g.
    > show them something's happening - e.g. animated gif progress bar or
    > something) and then automatically show the "done" page when the processing
    > is finished.
    >
    > Thanks!
    >
    >
     
    Alex Homer, Oct 16, 2004
    #8
    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. Stephajn Craig

    Implement a Please Wait Page

    Stephajn Craig, Jul 24, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    537
  2. Craig Deelsnyder

    Re: best way to do a "please wait" message

    Craig Deelsnyder, Aug 3, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    795
  3. joe kenney

    please wait.. page

    joe kenney, Aug 14, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    3,448
    S. Justin Gengo
    Aug 14, 2003
  4. KK
    Replies:
    2
    Views:
    646
    Big Brian
    Oct 14, 2003
  5. Huey

    How to make "fork/wait" to WAIT longer?

    Huey, Mar 1, 2004, in forum: C Programming
    Replies:
    1
    Views:
    1,978
    -berlin.de
    Mar 1, 2004
Loading...

Share This Page