Do I need to raise an event?

Posted on 2006-04-25
Medium Priority
Last Modified: 2012-05-05
Hi everyone,

I've written an asp.net page that allows for a spreadsheet to be selected (browsed for) and imported into our SQL database. That works fine - however as it takes about 10 minutes to process and upload all the data I was hoping to display a graphic to the user to show that the data is loading.

When the import button is clicked, obviously a postback is raised, I display my graphic (or so I thought) using an image control with runat=server and the import goes ahead... however, the graphic never gets displayed - it goes striaght into the import code.  I presume the grapic hasn't been rendered on the page?

So my question is, how can I get the graphic to render before it hits the import code? Do I need to raise an event or something?  When the import finished I then hide the image.

Question by:obyapka

Accepted Solution

the_paab earned 375 total points
ID: 16541688
You must use Javascript. It is display graphic before processing is hand on server. Graphic is displeyd as last action before postback, after postback page is reloaded and wait message disappears.
Try use this:
    <script type="text/javascript">
        function PleaseWait()
            // make the mouse cursor into the "wait" hourglass
            document.body.style.cursor = "wait";
            document.getElementById("lresult").innerText = ""
            // show the please wait div
                var message = document.getElementById( "PleaseWait" );
                if (message) message.style.display = "block";

            // allow the form to post back
            return true;
    <style type="text/css">#PleaseWait {
      BORDER-RIGHT: #000 1px solid; PADDING-RIGHT: 20px; BORDER-TOP: #000 1px solid; DISPLAY: none; PADDING-LEFT: 20px; BACKGROUND: #ffff9b; LEFT: 50px; PADDING-BOTTOM: 20px; BORDER-LEFT: #000 1px solid; WIDTH: 200px; PADDING-TOP: 20px; BORDER-BOTTOM: #000 1px solid; POSITION: absolute; TOP: 50px

<form onsubmit="PleaseWait()" runat="server">
        <div id="PleaseWait" style="LEFT: 51px; TOP: 37px">
            <p style="TEXT-ALIGN: center">
                Please wait....

Author Comment

ID: 16547269
At your suggestion I've created a DIV block around the image with display style of none, and I've tied the Update button to some javascript, so that when its precessed it displays the image in a DIV block - all that is great, however the image is an animated GIF which doesn't animate when the IE status bar is slowly growing!!  Does this happen with all GIF files or is there a way around it?


Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Integration Management Part 2
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month13 days, 12 hours left to enroll

755 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question