Gif wont run while processing is taking place

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    Gif wont run while processing is taking place

    Hi there,

    I'm developing an ASPX web application system and at times the processing takes a while to finish. In order to keep the users from closing the browser before my site is finished working, I thought I'd display an animated .gif that would indicate my system was doing something.

    The problem I'm having is that the gif doesn't do its animated thing when my site is processing. A progress bar is displayed and shows some progress at the bottom of the browser but the gif won't do its thing.

    Does anyone know how I can get around this problem?

    Thanks in advance
    -Frin
  • b1randon
    Recognized Expert New Member
    • Dec 2006
    • 171

    #2
    Frin, I work on an application that does exactly this. You might want to think about using ajax. Ajax will allow you to check on the server's progress on your task intermittently. Also, since your page will no longer be loading it may clear up the problem with the animated gif (our project uses on too without issue).

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      Originally posted by b1randon
      Frin, I work on an application that does exactly this. You might want to think about using ajax. Ajax will allow you to check on the server's progress on your task intermittently. Also, since your page will no longer be loading it may clear up the problem with the animated gif (our project uses on too without issue).

      I have absolutely no experience with Ajax. I hadn't even heard of it 'til the other month when I started posting on this forum.

      Is it easy to learn?
      Is it easily incorporated into a .NET application?
      Is it anything like JavaScript?

      Thanks for the suggestion

      -Frinny

      Comment

      • AricC
        Recognized Expert Top Contributor
        • Oct 2006
        • 1885

        #4
        Hey Frin, how much data are you processing? Is this in ASP? You could use Application.Loc k while your processing ( performance may be an issue )

        (Moved thread to Javascript/Ajax)

        Comment

        • Frinavale
          Recognized Expert Expert
          • Oct 2006
          • 9749

          #5
          Originally posted by AricC
          Hey Frin, how much data are you processing? Is this in ASP? You could use Application.Loc k while your processing ( performance may be an issue )

          (Moved thread to Javascript/Ajax)

          I'm using VB .Net (which uses asp of course)

          I'm doing a bunch of validation requests that run against a database. Its quite a bit of processing and for the database to timeout its sometimes taking something like 30seconds....

          I've never heard of Application.Loc k before.
          I'm going to look into it now to see if it could help me.

          I just looked up Ajax stuff and even though it looks like something I'd want to implement in the future...I can't really learn this right now and write the server side functions since my project is going to be launched within the next couple of days.

          I didn't think it would take much to get an animated .gif to run while sever processing was happening. I guess I was wrong.

          Thanks for all your help
          -Frinny

          Comment

          • AricC
            Recognized Expert Top Contributor
            • Oct 2006
            • 1885

            #6
            I don't think it is that difficult, in fact I'm moving this to the .Net forum and copy the ASP forum as this is more of an ASP.Net issue. As a work around for the time being maybe this solution would work. While the user is in the process if in your Try/Catch you hit an excError ( what I call mine ) throw the error to a log file on your server. Then just check the log file for errors daily or write a script to get it emailed to you. I have a great example of a VB.Net error file writer if you need one. I will just need to dig it up. Let me know.


            HTH,
            Aric

            Comment

            • kenobewan
              Recognized Expert Specialist
              • Dec 2006
              • 4871

              #7
              If the animated gif is showing and is not animated, then I believe that there is a problem with the image. Confirm by opening by itself in the browser. If this is the case, you need to recreate or find another image...

              Comment

              • Killer42
                Recognized Expert Expert
                • Oct 2006
                • 8429

                #8
                Originally posted by kenobewan
                If the animated gif is showing and is not animated, then I believe that there is a problem with the image. Confirm by opening by itself in the browser. If this is the case, you need to recreate or find another image...
                You may find that it's browser-specific.

                Sorry to butt in, I know virtually nothing about ASP, or web programming in general. However, just from the end-user perspective, I've noticed in IE that animated GIFs always stop whenever any link is clicked. FireFox, on the other hand, appears to leave them running, in at least some cases. For example, click on someone's avatar on the leader-board to the right. Under IE (for me, at least) my avatar immediately stops. Under FireFox, it keeps right on animating until the page disappears.

                Comment

                • Frinavale
                  Recognized Expert Expert
                  • Oct 2006
                  • 9749

                  #9
                  Originally posted by AricC
                  I don't think it is that difficult, in fact I'm moving this to the .Net forum and copy the ASP forum as this is more of an ASP.Net issue. As a work around for the time being maybe this solution would work. While the user is in the process if in your Try/Catch you hit an excError ( what I call mine ) throw the error to a log file on your server. Then just check the log file for errors daily or write a script to get it emailed to you. I have a great example of a VB.Net error file writer if you need one. I will just need to dig it up. Let me know.


                  HTH,
                  Aric

                  I actually do recording the error...but not into a file....


                  Thanks for the suggestion though. Its a good one!

                  -Frinny

                  Comment

                  • Frinavale
                    Recognized Expert Expert
                    • Oct 2006
                    • 9749

                    #10
                    Originally posted by kenobewan
                    If the animated gif is showing and is not animated, then I believe that there is a problem with the image. Confirm by opening by itself in the browser. If this is the case, you need to recreate or find another image...
                    There is nothing wrong with the gif. I've checked it in browsers and picture viewers alike. It just simply will not work when the browser is waiting for a response from the server....the whole point to putting it in is go give the user something to watch to keep them from closing the web browser while some processing is happening.

                    Originally posted by Killer42
                    You may find that it's browser-specific.

                    Sorry to butt in, I know virtually nothing about ASP, or web programming in general. However, just from the end-user perspective, I've noticed in IE that animated GIFs always stop whenever any link is clicked. FireFox, on the other hand, appears to leave them running, in at least some cases. For example, click on someone's avatar on the leader-board to the right. Under IE (for me, at least) my avatar immediately stops. Under FireFox, it keeps right on animating until the page disappears.
                    I've noticed this too.

                    I've also noticed while FireFox is waiting for the site to finish processing that sometimes (not always because sometimes it works flawlessly) the image isn't even loaded onto the page. I've used javaScript to change the image source once the submit button's clicked ...and when I view the html code this value has been changed properly...it should be displaying, but the browser's waiting for a response.

                    Hmmm...I wonder if there's a way to tell the browser to wait but not pause everything. I guess this is how Ajax would help out here. I'm just not sure what to write for the server side script that the Ajax code would call to display a gif...it seems to be overkill (and I've never used Ajax)...that and I'm not sure if Ajax is used the same way JavaScript is used for .Net applications.


                    Thanks for all the suggestions!

                    -Frinny

                    Comment

                    • Frinavale
                      Recognized Expert Expert
                      • Oct 2006
                      • 9749

                      #11
                      Originally posted by AricC
                      I
                      ... I have a great example of a VB.Net error file writer if you need one. I will just need to dig it up. Let me know.
                      HTH,
                      Aric
                      I'm interested in how you were able to write a file to the disk. I haven't been able to do this in the past...and I'm sure its a permissions problem, but even though I've tried to grant permissions to the ASPNET user to let the program write the file, I've had no luck.

                      What sort of permissions did you use to get this to work?

                      Thanks again for your help!

                      -Frinny

                      Comment

                      • Frinavale
                        Recognized Expert Expert
                        • Oct 2006
                        • 9749

                        #12
                        Originally posted by AricC
                        Hey Frin, how much data are you processing? Is this in ASP? You could use Application.Loc k while your processing ( performance may be an issue )

                        (Moved thread to Javascript/Ajax)

                        I remember now what Application.Loc k is used for:

                        Originally posted by MSDN Library:[url
                        http://msdn2.microsoft .com/en-gb/library/ms525184.aspx[/url]
                        The Lock method blocks other clients from modifying the variables stored in the Application object, ensuring that only one client at a time can alter or access the Application variables...
                        I tried it just in case it would help out the situation but it doesn't. I remember using this in school....it seems so long ago.

                        Thanks for the refresher!

                        Comment

                        • AricC
                          Recognized Expert Top Contributor
                          • Oct 2006
                          • 1885

                          #13
                          Originally posted by Frinavale
                          I remember now what Application.Loc k is used for:
                          I tried it just in case it would help out the situation but it doesn't. I remember using this in school....it seems so long ago.
                          Thanks for the refresher!
                          Do you think something like this would work?

                          Comment

                          • Frinavale
                            Recognized Expert Expert
                            • Oct 2006
                            • 9749

                            #14
                            Originally posted by AricC
                            Do you think something like this would work?
                            Thank you so much Aric!

                            I have no idea how this fixed my problem but it did.

                            I didn't use the code from that example but used the <body onload="..."> idea then wrote my own function. I initialized the image to show the processing gif and then changed the source of this image to be a blank image.

                            Now the processing message appears when the page is loading and then it goes away. When the user clicks the submit button I called a function to show the picture again.

                            For some reason when I did the exact same thing in the button's onclick the gif froze....but now that I'm calling a function it works fine.

                            This solution is working flawlessly in both FireFox and IE.

                            The functions I used were:
                            Code:
                            <script type='text/javascript' language='JavaScript'>
                             <!--
                                                function processingMessageOn() {
                                                document.img_processing.src='Images/Email.gif';
                                                }
                                                function processingMessageOff() {
                                                document.img_processing.src='Images/Blank.jpg';
                                                }
                              -->
                            </script>
                            I don't know why this fixed the problem but I'm happy for the simple solution.

                            I was starting to go off on a tangent with Ajax...this was much easier.

                            If anyone knows why this works I would love an explanation


                            Thanks so much!

                            -Frinny

                            Comment

                            • AricC
                              Recognized Expert Top Contributor
                              • Oct 2006
                              • 1885

                              #15
                              Originally posted by Frinavale
                              Thank you so much Aric!

                              I have no idea how this fixed my problem but it did.

                              I didn't use the code from that example but used the <body onload="..."> idea then wrote my own function. I initialized the image to show the processing gif and then changed the source of this image to be a blank image.

                              Now the processing message appears when the page is loading and then it goes away. When the user clicks the submit button I called a function to show the picture again.

                              For some reason when I did the exact same thing in the button's onclick the gif froze....but now that I'm calling a function it works fine.

                              This solution is working flawlessly in both FireFox and IE.

                              The functions I used were:
                              Code:
                              <script type='text/javascript' language='JavaScript'>
                               <!--
                                                  function processingMessageOn() {
                                                  document.img_processing.src='Images/Email.gif';
                                                  }
                                                  function processingMessageOff() {
                                                  document.img_processing.src='Images/Blank.jpg';
                                                  }
                                -->
                              </script>
                              I don't know why this fixed the problem but I'm happy for the simple solution.

                              I was starting to go off on a tangent with Ajax...this was much easier.

                              If anyone knows why this works I would love an explanation


                              Thanks so much!

                              -Frinny
                              Frin,
                              Glad we finally found something that works for your issue. I have never had any ASP.Net write problems when writing log files I will try to find my example maybe it will help maybe not.

                              Aric

                              Comment

                              Working...