Do I need to raise an event?

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.

Brian
LVL 1
obyapkaAsked:
Who is Participating?
 
the_paabCommented:
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:
...
<head>
    <title>PageTitle</title>
    <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
            if(document.getElementById)
            {
                var message = document.getElementById( "PleaseWait" );
                if (message) message.style.display = "block";
            }

            // allow the form to post back
            return true;
        }
    </script>
    <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
}
</style>
</head>
...

<form onsubmit="PleaseWait()" runat="server">
        <div id="PleaseWait" style="LEFT: 51px; TOP: 37px">
            <p style="TEXT-ALIGN: center">
                Please wait....
            </p>
        </div>
....
0
 
obyapkaAuthor Commented:
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?

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.