473,419 Members | 1,646 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

"Loading message" while loading ASP.NET pages

Can anyone plz suggest any Idea that How to implement "loading message" in a site with master pages.
I am having Default page which is master page enabled and it contains many Gridviews with database connection.
This page is taking so much of time to load therefore I want to show loading message for this page only.

Thanks in advance..
Sep 16 '09 #1
7 11733
ssnaik84
149 100+
this functionality is generally used with AJAX; if you want it in normal coding..

Expand|Select|Wrap|Line Numbers
  1. protected void Page_Load(object sender, EventArgs e)
  2. {
  3.    imgLoadingData.Visible = true;
  4.  
  5.    BindYourAllControls();
  6.  
  7.    imgLoadingData.Visible = false;
  8.  
  9. }
  10.  
for better look-n-feel, create a layer and after loading all data, hide it.
Sep 16 '09 #2
Frinavale
9,735 Expert Mod 8TB
This is going to have to be implemented using JavaScript (not C# as ssnaik84 as suggested).

How this is implemented depends on whether or not your page is using Ajax. If it's using Ajax (UpdatePanels) then you could display the message when the PageRequestManager is in it's beginRequest event...then hide the message when the endRequest event occurs.

If you aren't using Ajax then you should just display the message during something like the onbeforeunload event.

Displaying the message is pretty easy.
Just add an ASP.NET Label or Panel to the page and give it a style="display:none"...then in the JavaScript change the style to display:block.

Eg (only works with no Ajax):
Expand|Select|Wrap|Line Numbers
  1. window.onbeforeunload=showMessage;
  2. showMessage(){
  3.   var message = document.getElementById('<%=Message.ClientID %>');
  4.   if(message)
  5.   {
  6.     message.style.display='block';
  7.   }
  8. }
Sep 16 '09 #3
I am using Ajax Toolscript Enabled website with master page.
Can you suggest how to implement this process in my site.
Sep 18 '09 #4
Frinavale
9,735 Expert Mod 8TB
What's "Toolscript"?


Is your content in an UpdatePanel?
Does the content participate in asynchronous ajax requests?
Sep 18 '09 #5
Yes my content are in UpdatePanel.
And contents participate in asynchronous ajax requests.
Sep 19 '09 #6
Frinavale
9,735 Expert Mod 8TB
First you need to add a label to the page with the Loading Message. Set the style of the loading message to display:none so that it is hidden on the page until you want to display it. Write a JavaScript method that can be called to display the message (it should set the label's style to display:inline or something to show it) and another method to hide the message (it should set the label's style to display:none).

You should call these methods when the PageRequestManager is beginning the Ajax request and ending the Ajax request. You do this by grabbing a reference to the PageRequestManager and then indicating the methods that should be executed using the add_beginRequest and add_endRequest methods.

For example, say your JavaScript methods to show and hide the message were called "ShowLoadingMessage" and "HideLoadingMessage", you would use the PageRequestManager like:

Expand|Select|Wrap|Line Numbers
  1. Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(ShowLoadingMessage);
  2. Sys.WebForms.PageRequestManager.getInstance().add_endRequest(HideLoadingMessage);
  3.  
  4. function ShowLoadingMessage(sender, args)
  5. {
  6.    var message = document.getElementById("<%=LoadingMessageLabel.ClientID%>");
  7.    if(message){
  8.      message.style.display = "block";
  9.    }
  10. }
  11. function HideLoadingMessage(sender, args)
  12. {
  13.    var message = document.getElementById("<%=LoadingMessageLabel.ClientID%>");
  14.    if(message){
  15.      message.style.display = "none";
  16.    }
  17. }
Sep 21 '09 #7
Thanks it worked for me..
Sep 22 '09 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Michelle Anderson | last post by:
Hi, I have this code so it will ask user if they want to save if they click on the "close" button. But some how it also pops up the message when I click on the save button. Is there a way to...
4
farooqbob
by: farooqbob | last post by:
When i sending a HTML mail I getting this Erro "could not access "CDO.Message" object" How can i fix this problem
4
by: ssq | last post by:
Hi, I wrote a RunSQL Macros to drop a table and used that on a button. How should i add an "Alert" to it i.e; i should get an "Alert Message" as soon as i click that button.
1
by: ashish | last post by:
Dim oCon Err.Clear Set oCon = Server.CreateObject("ADODB.Connection") If Err.Number = 0 Then '// '// Open an ADODB.Connection to the folder URL '// oCon.Provider = "ExOLEDB.DataSource"
6
by: arnuld | last post by:
I don't understand, every week I post "Welcome Message" as a new post and it gets posted as reply to my older "Welcome Message", automatically. What exactly is happening ? I have tried both PAN...
1
by: =?Utf-8?B?QUcgTW9yZW5v?= | last post by:
I had a virus. Ran Norton Antivirus. Now when I start my computer I get "FTP Port is used" error message and no internet access, however, computer is connected to wireless home network. Any...
14
by: yuvang | last post by:
Please help on how to show a busy message like "Please wait" or a "analytical animated watch" in ms access when a process in running.
7
by: divyac | last post by:
I want to show a Progress bar image while loading ASP.NET pages in the browser. I am using ASP.NET 2.0/C#.I want to do it in javascript and not with ajax.help me pls........
0
by: dieudonn | last post by:
Hi everyone! I want to add a toolbar (or a button ) to toolbars of the compose message window. I added a functional toolbar to the outlook main window. When i am supposed to add another toolbar...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.