2

I have code in my Page_load method that can take up to a few seconds to fetch back the data and store it into a table.

How can I display a percentage (or just generic) loading bar until all the data is ready, as oposed to just having the empty table until the data is ready?

Is there an asp control dedicated to progress bars?

2 Answers 2

6

The short answer is: you can't. A possibility would be to break-up the tasks that are performed in Page_Load, call them synchronously using Ajax while updating a progress bar client-side.

Sign up to request clarification or add additional context in comments.

Comments

1

If you simply want to show the data, you may use ana ajax call to server on the dom ready If event and show it

<div id="myTableDate"> </div>
<script type="text/javascript">

$(function(){
   //Whatever inside this block will be executed once DOM finishes loading
   $("#myTableDate") .html("Loading data....").fadeIn(100,function(){
      $("#myTableDate").load("getdata.aspx");
   });    
});

</script>

And you should have a getdata.aspx page which returns the HTML markup you wish to display.

You may alternatively use ashx handlers to get the HTML Markup data. (this is my preference)

This solution needs jQuery library to be included in your page.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.