ASP.NET,Javascript: Message while retreiving data from database

I have a gridview in which I mantain sorting and paging. The problem is that some times it takes time (more that 15 seconds) to show a new page or the resut of a sort. I would like to know how I can show a message to the user, telling that the the system is looking for data. Please don't give me ajax solution as I am not using it in my application.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Anurag ThakurTechnical ManagerCommented:
you can use the ajax progress bar or a splash screen to indicate to the user that some action is being taken
ASP.NET/ AJAX Page Loader Progress Bar/ Splash Screen -
karakavAuthor Commented:
I think you didn't read well my thread. I say that Ajax is NOT an option for me.
Anurag ThakurTechnical ManagerCommented:
sorry my fault is a javascript based sampel but you will have to improvise on that as the demo is called for a specific period time but in your case you might want to hide the progress bar after you results have been bound on the grid on the postback
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

karakav, you hit the bulls eye. this is by far one of the most common tasks developers like me and you would need. there can be many ways to do it. let me suggest you 2 simple methods to achieve what you must. you can chose what suits you best.

1) dedicate a new htm page for the busy/waiting message you are trying to show. create a new htm page and put on the message on it say " Executing your request..." or someting like that. You can also put up a busy icon image (gif) and put it up along with it. When the ongoing activity is completed, then if you can, put up a session flag and turn it to true  in the main aspx page where the activity was happening. now check for this session flag in the htm page we just created. if the flag is true, redirect to the aspx main page, else remain on the htm page. if you can't set up a session ( i.e  you cant control the exact time when the activity is completed), then let the htm page automatically redirect to the main page after a fixed amount of time.
you can accomplish this with the Meta refresh tag in htm like:

<META HTTP-EQUIV=Refresh CONTENT="2; URL="your main page.aspx">
where the '2' is the time in seconds after which the redirection takes place.

2) second option can be to put up a label on your main aspx page with the "busy" message and toggle it to be hidden if visible , or visible if hidden using a javascript. and call this toggle function on the control that initiates the activity which is taking time to execute( like the sort you mention for which i believe it would be selected index changed for the dropdown that is selected, or the click of a button) you can call the javascript toggle function on the control say for e.g if the activity happens on the click of a button then call is as:

btn.Attributes.Add("onclick", "return toggle();");

where toggle is your function name.
the entire process should be as follows:

a) make the "busy message" label's visible property to true.
b) call the toggle function on page load from html of the aspx page so that the label is hidden after the toggle is executed on page load.
use <body onload="toggleVisibility();"> in html of the main aspx page.
c) now  on page_load event of the aspx page (server side code), call the javascript function on the appropriate control as
btn.Attributes.Add("onclick", "return toggle();");

thats it. this should work for you. give it a shot and let me know when you have any doubt implementing it. if you need the javascript for the toggle function itself, let me know i can send it to you.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
karakavAuthor Commented:
Actually I would be thankful if you send me a snippet. I failed to implement you solution I don't know why.
well you should tell me where you are facing the problem. its easier to sort that way.
the snippet will be only for the toggle function, the rest you need to implement the way i have listed.
i have writtern the code as well in between the lines. its not much of coding actually...
karakavAuthor Commented:
Actually because I am accessing a single method from many locations(sorting,pageindex,page load) I put the following code before and after calling the database:
//Code behind
private void GetData()
            ClientScript.RegisterStartupScript(typeof(String), "busy", "toggleLabel('none') ;", true);
//The data retreival logic goes here
            ClientScript.RegisterStartupScript(typeof(String), "freenow", "toggleLabel('') ;", true);
//Here is the Javascript function
        function toggleLabel(condi) 
                document.getElementById("lblProgress").style.display = condi;                    

Open in new window

not sure what for you are using the ClientScript.RegisterStartupScript part.

use the below toggle function in your main page for activity.

<script type="text/javascript">      
         function toggleVisibility()  
              var control = document.getElementById("busy");    
              if( == "visible" || == "")      
           = "hidden";          
           = "visible";      
and follow all the steps i mentioned in option 2 and call this function.
karakavAuthor Commented:
Thank you Champion. You really are the best.  Thank you very much.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.