Best way to show loading post before ASP.NET page has loaded
I have an ASP.NET web page where I have multiple DIVs (with runat = "server") and I am showing records from the DB in that. The number of records / data to be shown will be huge a few times, I have put the code to load the content in a div, in my Page_Load event. But when the page loads, I see a blank screen for a few seconds and then show the page content. I want to rule it out. Instead, I want to show a "Loading" message to the user before all the page content has loaded. What's the best way to do this?
Some options came to my mind
1 Response.Flush Response.Buffer
2 Remove the code to load content in the page load event. Load the content instead with jQuery load / ajax functions on document.ready
Can anyone tell me a betting method to solve this problem
source to share
You can lock the UI with a good busy message.
Mark:
$(function() { // when document has loaded
($.unblockUI); //unlock UI
//Show busy message on click event and disable UI
$('#btnHelloWorld').click(function() {
$.blockUI({ message: '<h4><img src="busy.gif" />Please wait...</h4>' });
});
});
<asp:Button ID="btnHelloWorld" runat="server" Text="Hello World" /><br/>
Code behind:
Protected Sub btnHelloWorld_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnHelloWorld.Click
Label1.Text = "Hello World"
Threading.Thread.Sleep(5000)
End Sub
Check the jQuery BlockUI Plugin
source to share