Are you doing this on first page load, or is there some button you press to show "loading" while say the gridview loads?
if this is a button click on the page, then just add both client side code and server side code to the button click.
So, say a button, and this gv:
<asp:Button ID="cmdLoad" runat="server" Text="Load Data" CssClass="btn"
OnClick="cmdLoad_Click"
OnClientClick="$('#mywait').show();"/>
<br />
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="ID" CssClass="table" Width="50%">
<Columns>
<asp:BoundField DataField="FirstName" HeaderText="FirstName" />
<asp:BoundField DataField="LastName" HeaderText="LastName" />
<asp:BoundField DataField="HotelName" HeaderText="HotelName" />
<asp:BoundField DataField="City" HeaderText="City" />
<asp:BoundField DataField="Description" HeaderText="Description" />
</Columns>
</asp:GridView>
<div id ="mywait" style="display:none">
<h3>Loading grid - please wait</h3>
<img src="Images/wait2.gif" />
</div>
So, when we click the button, we show the please wait - and a spinner.
Code behind is this:
protected void cmdLoad_Click(object sender, EventArgs e)
{
LoadGrid();
}
void LoadGrid()
{
using (SqlConnection conn = new SqlConnection(Properties.Settings.Default.TEST4DB))
{
using (SqlCommand cmdSQL =
new SqlCommand("SELECT * FROM tblHotelsA ORDER BY HotelName",conn))
{
conn.Open();
DataTable rstData = new DataTable();
rstData.Load(cmdSQL.ExecuteReader());
GridView1.DataSource = rstData;
GridView1.DataBind();
// fake 2 second loading time
System.Threading.Thread.Sleep(2000);
}
}
}
And results look like this:

So, by adding both a client side code and server side to the same button, you get the above effect.