C# .NET - Loading Screen - Asked By Ajay on 01-Mar-12 05:00 AM

Hi All

I Just need a loading Screen for my web application. when ever that particular page is being opening  this loading screen should be showing for particular time.How to make it

Regards
Ajay
kalpana aparnathi replied to Ajay on 01-Mar-12 05:09 AM
hi,

You can use a http://msdn.microsoft.com/en-us/library/cc221403%28v=vs.95%29.aspx in order to execute your functionality in a separate thread. http://msdn.microsoft.com/en-us/library/cc221403%28v=vs.95%29.aspx has a lot of feature to support for the functionality that you are looking for. If you didn't use another thread to execute your function, the main thread (UI thread) will be busy and child window won't work properly.

Regards,
Ajay replied to kalpana aparnathi on 01-Mar-12 05:19 AM
Could you give any example for that
kalpana aparnathi replied to Ajay on 01-Mar-12 05:22 AM
use this link:http://www.albahari.com/threading/part3.aspx

Ajay replied to kalpana aparnathi on 01-Mar-12 05:35 AM
I am not getting how to use it. That too i am dealing with Web Application.
dipa ahuja replied to Ajay on 01-Mar-12 05:36 AM
If you have never created a Splash screen then here i am giving you simple example:
 
1. Take one form and set the FormBorder = None
2. Take one timer Control on form , set the property Enabled=true and interval = 30
3. Set a BackGround image as you like for your splash screeen
4. Take a ProgressBar on you Form and set the Style propery as Marquee for standard look
5. Implement the timer's Tick Event:
 
private void timer1_Tick(object sender, EventArgs e)
    {
      progressBar1.Value += 1;
      label2.Text = progressBar1.Value.ToString();
      if (progressBar1.Value >= 100)
      {          
        Login l = new Login();
        l.ShowDialog();
        l.MdiParent = m1;
      }
    }
Now after the splash screen completed the Login form will be shown..
 
Hope this will help you
 
 
Somesh Yadav replied to Ajay on 02-Mar-12 04:20 AM

I use http://jquery.malsup.com/block/ plugin for such requirement. Its pretty simple and straight forward to use. For example:

$.blockUI({ message: '<h2>Loading</h2>' });
// call to the web service

And in success and failure callbacks of ajax request, include call to unblock

$.unblockUI();