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.

Thanks.
RadhaKrishnaKiJayaAsked:
Who is Participating?
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.

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

Label1.Text="Processing..."
0
RadhaKrishnaKiJayaAuthor Commented:
Sorry. It did not work.

Thank you for ur reply.
0
YZlatCommented:
What exactly didn't work? Can you post more details about your application and what is it doing
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

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

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

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
    	  }

</script>

Open in new window

0
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">
   
    <title></title>
    <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
            }

    </script>

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

   
   
         <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" />
           
            </asp:GridView>
           
       
        </div>

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

 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
        con.Open()
        GVViewParts.DataSource = cmd.ExecuteReader()
        GVViewParts.DataBind()
        con.Close()

    End Sub

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

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

Open in new window

0
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.
0
YZlatCommented:
In that case try just removing an image from the div:

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

</div>
0
RadhaKrishnaKiJayaAuthor Commented:
How can I display it in the center?

Thanks.
0
YZlatCommented:
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 ;
}
</style>

Open in new window

0

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.
0
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
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.