Display "please wait" option untill you fetch data from database
Below code will help you to display "Please wait" window whiel you retrieve data from database. This is usefull when your database operation take long time.
To start with, first we will add below JavaScript code. Usual practice is to add JavaScript code just below your <HEAD> tag.
<script language="javascript">
function do_totals1()
{
document.all.pleasewaitScreen.style.visibility="visible";
window.setTimeout('do_totals2()',1)
}
function do_totals2()
{
calc_totals();
document.all.pleasewaitScreen.style.visibility="hidden";
}
</script>
Add below div tag just below your <BODY> tag, this will build a table with "Retrieving Data. Please wait..." label/window. You can modify look and feel of the div tag based on the theme you are using in your website.
Here i have used spinner.gif image for a good look, download one nice spinner image and give the path accordingly to give nice appearance.
<DIV id="pleasewaitScreen" style="Z-INDEX: 5; LEFT: 40%; VISIBILITY: hidden; POSITION: absolute; TOP: 30%">
<TABLE borderColor="#5ba789" height="100" cellSpacing="0" cellPadding="0" width="300" bgColor="#5ba789" border="1">
<TR>
<TD vAlign="middle" align="center" width="100%" bgColor="#e4f0db" height="100%"><BR>
<BR>
<IMG src="Images/spinner.gif" align="middle"> <FONT face="Lucida Grande, Verdana, Arial, sans-serif" color="#000066" size="2">
<B>Retrieving Data. Please wait...</B></FONT>
<BR>
<BR>
</TD>
</TR>
</TABLE>
</DIV>
And finally to call JavaScript function on click of submit button from code behind add below code in Page_Load.
if (! IsPostBack)
{
btnSubmit.Attributes.Add("onclick","return do_totals1();");
}
you are not implemented calc_totals().