Link to home
Start Free TrialLog in
Avatar of karakav
karakav

asked on

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

Hi,
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.
Avatar of Anurag Thakur
Anurag Thakur
Flag of India image

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 - http://www.codeproject.com/KB/aspnet/ASPNETAJAXPageLoader.aspx
Avatar of karakav
karakav

ASKER

I think you didn't read well my thread. I say that Ajax is NOT an option for me.
sorry my fault
http://www.daniweb.com/forums/thread30366.html 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
ASKER CERTIFIED SOLUTION
Avatar of snowalps
snowalps

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of karakav

ASKER

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...
Avatar of karakav

ASKER

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(control.style.visibility == "visible" || control.style.visibility == "")      
                {
                    control.style.visibility = "hidden";          
                }
                else                
                {
                    control.style.visibility = "visible";      
                }
           }
      </script>
and follow all the steps i mentioned in option 2 and call this function.
Avatar of karakav

ASKER

Thank you Champion. You really are the best.  Thank you very much.