Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

This was one of those things that was too easy to get, so I thought I would post it here and save the next person some grief

 

In your master template, put this in your code behind:

 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
       If Not Page.IsPostBack Then
'create an image here - this can be any img that already exists on the site
           Response.Write("<img id='img1' src ='images/red-x.gif' Style='left: 500px; position: absolute; top: 200px' />")
           Response.Write("<script language=javascript>;")
           Response.Write("var dots = 0;")
           Response.Write("var dotmax = 10;")
           Response.Write("function ShowWait(){")
           Response.Write("}")
           Response.Write("function StartShowWait(){")
           Response.Write("var output;")
           Response.Write("output=document.getElementById('img1');")
           Response.Write("output.style.visibility='visible';")
           Response.Write("window.setInterval('ShowWait()',1000);")
           Response.Write("}")
           Response.Write("function HideWait(){")
           Response.Write("var output;")
           Response.Write("output=document.getElementById('img1');")
           Response.Write("output.style.visibility = 'hidden';")
           Response.Write("window.clearInterval();")
           Response.Write("}")
           Response.Write("StartShowWait();</script>")
           Response.Flush()
           Thread.Sleep(10000)
       End If
   End Sub

 

At the top of the page, add 'Imports System.Threading to accomodate the Thread.Sleep

 

Now, on the HTML source for the Master Template page, go to the Body line and add

 

onload="HideWait();

 

Don't forget the semicolon or it won't work

 

Now this image pops up as pages load and, when the page is DONE loading, it executes the Javascript 'HideWait' function and kills the image. You don't have to do anything to any of the other pages

Read the Fovean Chronicles

Because you just can't spend your whole day programming!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...