Code for Loading Image when you click on Submit Button

K011gusain89
Posted by K011gusain89 under ASP.NET category on | Points: 40 | Views : 1433
You have seen when we click on submit button then image is loading and sain please wait, how this is happen I show that in this code.
Firstly you need a animated image for loading


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<style type="text/css">
.pleasewait
{
height:140px;
width:241px;
background-image:url('image/PleaseWait.gif');
background-repeat:no-repeat;
padding-left:40px;

}
</style>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:UpdatePanel ID="updatepanel" runat="server">
<ContentTemplate>
<table runat="server" id="formTable">
<tr><td>name</td> <td><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td></tr>
<tr><td>Email</td> <td><asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></td></tr>
<tr><td></td> <td>
<asp:Button ID="Button1" runat="server" Text="submit" onclick="Button1_Click" /></td></tr>
</table>
<asp:Label ID="Label1" runat="server" Text="message sent" Visible="false"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div align="center">
<asp:UpdateProgress ID="updateprogress" runat="server" AssociatedUpdatePanelID="updatepanel">
<ProgressTemplate>
<div class="pleasewait">

</div>
</ProgressTemplate>
</asp:UpdateProgress>
</div>
</form>
</body>
</html>




C# Code



protected void Button1_Click(object sender, EventArgs e)
{
Label1.Visible = true;
formTable.Visible = false;
System.Threading.Thread.Sleep(3000);
//Response.Redirect("WebForm1.aspx");
}

Comments or Responses

Login to post response