[RESOLVED] Loading please wait in VB.NET while gridview loads data


I am trying to display the loading please message or a spinning image while a page loads data in a gridview. Users click on a link from one page and get redirected to another page via the response.redirect method. The new page loads some data in a gridview based upon some variables passed. Some times it could take up to 20+ seconds for the gridview to load. I have displayed loading please wait message previously using the jQuery, Post and ajax methods etc. In this case it's just straight VB.NET code that makes a sql connection to the server, executes a stored procedure and binds the returned data to the gridview. I would like the message or image to start showing once they click on the link to get redirected to the new page and continue to display till the gridview data has been loaded. Here is an example of the code:

Dim cmd As SqlCommand = New SqlCommand("CustOrderHist", New SqlConnection("Server=localhost;Database=Northwind;Trusted_Connection=True;"))
cmd.CommandType = Data.CommandType.StoredProcedure
cmd.Parameters.AddWithValue("CustomerID", txtCustID.Text)
gvwExample.DataSource = cmd.ExecuteReader()
Catch ex As Exception
lblStatus.Text = ex.Message
End Try


To avoid the loading time. What you can do is lazy load the gridview after the page is loaded using Updatepanel and Timer

This way your page will be loaded while the gridview will be populated later.


Thank you, this trick seemed to work great for me.

thoughts on "[RESOLVED] Loading please wait in VB.NET while gridview loads data"

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>