Splash screen on page

Posted on 2005-05-10
Last Modified: 2008-03-10
My web app will be sending multiple emails. this could be processor intensive and i want to display a splash screen while this is generating and sending the personnalised emails.

How do i add a splash screen while this is happening?

I tried a simple Response.Flush() before the bulk of the code, but *shrugs*

Also can i implement this to a user control and not a page? As my app is all user controls


Question by:apb2
    LVL 23

    Expert Comment

    by:Jens Fiederer
    Do the processor intensive part in a separate thread, and redirect to a page that refreshes itself every so often and checks whether that thread is done.
    LVL 33

    Expert Comment

    Response.Flush really doesn't work anymore like it did in ASP since does all the processing work before it generates any html.  There are plenty of solutions available on the internet/EE that demonstrate "Please Wait" examples, here is one:
    LVL 6

    Author Comment

    Hi raterus

    That solution is for a windows form. Have you got a solution for a web form

    Thanks again
    LVL 33

    Expert Comment

    whoops!  sorry about that..Here is something that is interesting,
    LVL 23

    Accepted Solution

    Very simple example of my approach:

    Thread Class (does the lengthy processing)
    mports System.Threading

    Public Class ThreadClass

        Public Shared Sub Proc()

            For i As Integer = 0 To 50
                Dim sw As New IO.StreamWriter("c:\inetpub\wwwroot\xp\data\log.txt", True)
                sw.WriteLine("line " & i.ToString)
        End Sub

    End Class

    Button handler (in your main page)
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim t As New Thread(AddressOf ThreadClass.Proc)
            Session("t") = t
        End Sub

    Splash page just has a label and any bling you want to add (updates every 5seconds (5000ms)):
      of course, instead of changing title to "done:" you can redirect to final page
        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'Put user code to initialize the page here
            Dim t As Thread = Session("t")
            If t.IsAlive Then
                Label1.Text = "still running:"
                Label1.Text = "done:"
            End If
            Dim sr As New IO.StreamReader("c:\inetpub\wwwroot\xp\data\log.txt")
            Label1.Text &= sr.ReadToEnd()
            RegisterClientScriptBlock("x", "<script type='text/javascript'>var s = 'window.document.forms[0].submit()'; window.setTimeout(s, 5000);</script>")
        End Sub
    LVL 6

    Author Comment


    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
    A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    746 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now