Display wait message in ASP.Net

Hi Experts,

I want to display some kind of wait message when the server is processing the client request. I am using ASP.net and VB.Net.
Please help.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

you could create a label and write a message to that label right before sending request to the server:

RadhaKrishnaKiJayaAuthor Commented:
Sorry. It did not work.

Thank you for ur reply.
What exactly didn't work? Can you post more details about your application and what is it doing
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

you could do it with javascript and hidden div on your page:

<div id="WaitLabel" visible="false">
    <img src="some image" />

Open in new window

and then use javascript to make it visible:

<script language ="javascript" type="text/javascript" >
  ShowMessage = function(divName)
     		document.getElementById(divName).style.visibility = "visible"
               document.getElementById(divName).innerHTML = 'Please Wait ... '; 
             	return true; //Returns the control to the Server click event


Open in new window

RadhaKrishnaKiJayaAuthor Commented:
Thank u very much for trying to help me. Here is my code. When I click submit I want to display the "Please wait image"

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script type="text/javascript" >

            ShowMessage = function (divName) {
                document.getElementById(divName).style.visibility = "visible"
                document.getElementById(divName).innerHTML = 'Please Wait ... ';
                return true; //Returns the control to the Server click event


    <form id="form1" runat="server">
     <div style="float:left; width:99.9%;">
                <asp:Button ID="btnSubmit" runat="server" Text="Submit" />

         <div style="float:left; width:99.4%; margin-left :5px" >
            <asp:GridView ID="GVViewParts" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None"  showfooter="true"  Width="99.4%" > <%--OnRowDataBound="setMouseover"--%>
                <AlternatingRowStyle BackColor="White" />
                <%--<EditRowStyle BackColor="#2461BF" />--%>
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <RowStyle BackColor="#EFF3FB" />
                <%--<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />--%>
                <SortedAscendingCellStyle BackColor="#F5F7FB" />
                <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                <SortedDescendingCellStyle BackColor="#E9EBEF" />
                <SortedDescendingHeaderStyle BackColor="#4870BE" />

        <div id="WaitLabel" visible="false">
            <img src="Image/Wait.gif" />

 Private Sub LoadCustomers()

        Dim strConnString As String = ConfigurationManager.ConnectionStrings("conn").ConnectionString
        Dim query As String = "SELECT PartID,LionPartNo,ManufacturerPartNo,PartDescription FROM parts"
        Dim cmd As SqlCommand = New SqlCommand(query)
        Dim con As SqlConnection = New SqlConnection(strConnString)
        'Dim sda As SqlDataAdapter = New SqlDataAdapter
        'Dim cmd As SqlCommand = Nothing
        'cmd.CommandText = query
        cmd.Connection = con
        GVViewParts.DataSource = cmd.ExecuteReader()

    End Sub

    Protected Sub btnSubmit_Click(sender As Object, e As EventArgs) Handles btnSubmit.Click
    End Sub
change btnSubmit as follows:

  <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClientClick ="ShowMessage('WaitLabel')" />

Open in new window

RadhaKrishnaKiJayaAuthor Commented:
Thank you very much. It is working but the image is displaying on form load. I want to display the image only when the button is clicked.  Also How can I display it in the center of the screen. Sorry for asking you very basic questions. I am new to .net programming
Thank u again.
In that case try just removing an image from the div:

<div id="WaitLabel" visible="false">

RadhaKrishnaKiJayaAuthor Commented:
How can I display it in the center?

add the following to the <head. section of your page:

<style media="screen" type="text/css">
#WaitLabel {
  width: 300px ;
  margin-left: auto ;
  margin-right: auto ;

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RadhaKrishnaKiJayaAuthor Commented:
Thank you very much.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.