Error page using the Application_Error void dosnt work when using DIV for a please wait message

Discussion in 'ASP .Net' started by s_erez@hotmail.com, Dec 23, 2004.

  1. Guest

    Hi,
    This is a realy tricky one.
    I have an ASP.NET application where some pages are reading data from a
    DB and presenting reports.
    In order for the user to wait while the page is reading data from the
    DB I am using a DIV with a please wait message which is removed once
    the page is loaded.
    In addition I am using a global error handling using the
    Application_Error void in the Global.asax file.
    when the application is loading a page which dosnt have the please wait
    div and an error occurs the Application_Error void is used to execute
    the code in it, but when a page which dose use the please wait DIV then
    i get a standart error message "An unhandled exception occurred during
    the execution of the current web request..."
    Here is code used to display the please wait DIV:

    private void Page_Load(object sender, System.EventArgs e)
    {
    Response.Write("<div
    id='mydiv' align='center' style='color:red ; font-size:28pt'>");
    Response.Write("Loading - Please Wait... <BR>");
    Response.Write("<IMG src='../Images/progressbar.gif'>");
    Response.Write("</div>");
    Response.Write("<script language=javascript>;");
    Response.Write("function HideWait(){");
    Response.Write("mydiv.style.visibility =
    'hidden';window.clearInterval();}");
    Response.Write("StartShowWait();</script>");
    Response.Flush();
    ....my code is here
    }
    Anyone has any idea why dosnt my application go to the
    Application_Error void when i am using the DIV to display the please
    wait message?
    Thanks,
    Erez.
    , Dec 23, 2004
    #1
    1. Advertising

  2. wrote in
    news::

    > Hi,
    > This is a realy tricky one.
    > I have an ASP.NET application where some pages are reading data
    > from a DB and presenting reports.
    > In order for the user to wait while the page is reading data
    > from the DB I am using a DIV with a please wait message which is
    > removed once the page is loaded.
    > In addition I am using a global error handling using the
    > Application_Error void in the Global.asax file.
    > when the application is loading a page which dosnt have the
    > please wait div and an error occurs the Application_Error void
    > is used to execute the code in it, but when a page which dose
    > use the please wait DIV then i get a standart error message "An
    > unhandled exception occurred during the execution of the current
    > web request..." Here is code used to display the please wait
    > DIV:
    >
    > private void Page_Load(object sender, System.EventArgs e)
    > {
    > Response.Write("<div
    > id='mydiv' align='center' style='color:red ; font-size:28pt'>");
    > Response.Write("Loading - Please Wait... <BR>");
    > Response.Write("<IMG src='../Images/progressbar.gif'>");
    > Response.Write("</div>");
    > Response.Write("<script language=javascript>;");
    > Response.Write("function HideWait(){");
    > Response.Write("mydiv.style.visibility =
    > 'hidden';window.clearInterval();}");
    > Response.Write("StartShowWait();</script>");
    > Response.Flush();
    > ...my code is here
    > }
    > Anyone has any idea why dosnt my application go to the
    > Application_Error void when i am using the DIV to display the
    > please wait message?


    Erez,

    This may or may not be the problem, but calling Response.Write in
    Page_Load will put the output *before* the page's opening <HTML> tag.
    (View the source in your browser to see what HTML is generated.)

    Instead of using Response.Write, use a Label and set its Text
    property to the HTML you want to output.

    --
    Hope this helps.

    Chris.
    -------------
    C.R. Timmons Consulting, Inc.
    http://www.crtimmonsinc.com/
    Chris R. Timmons, Dec 24, 2004
    #2
    1. Advertising

  3. Guest

    the idea is to put the output before the HTML tag so the user will see
    it while the page is loading.
    Erez
    , Dec 24, 2004
    #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. Ollej Reemt
    Replies:
    7
    Views:
    500
    Jack Klein
    Apr 22, 2005
  2. Stig Brautaset

    `void **' revisited: void *pop(void **root)

    Stig Brautaset, Oct 25, 2003, in forum: C Programming
    Replies:
    15
    Views:
    777
    The Real OS/2 Guy
    Oct 28, 2003
  3. Replies:
    5
    Views:
    815
    S.Tobias
    Jul 22, 2005
  4. Data.new dosnt work

    , Jul 25, 2003, in forum: Ruby
    Replies:
    1
    Views:
    97
  5. David Vlad

    Why dosnt this work

    David Vlad, Mar 12, 2010, in forum: Ruby
    Replies:
    1
    Views:
    93
    Brian Candler
    Mar 12, 2010
Loading...

Share This Page