How to display a loading message or image while the page is loading?
For example, when I click a button for adding items, it takes some time to finish loading, while it is loading, the page is active. What I want is a little loader to appear in the middle of the page and that page will turn inactive. When the page has finished loading, the loader will be gone and the page will get active.
Assuming you are using ASP.NET Webforms
You can easily use an
UpdatePanelassociated with anUpdateProgresscontrol.UpdatePanel allow you to use async to interact with server. You can add an UpdateProgress control and link it with the UpdatePanel to show something (Gif, Text,..) when loading is in progress.
Find more informations Here
If you are using Asp.net MVC, you have to do the same trick using Ajax like in this SO question.