jtaylorttt
Programmer
I have an .net aspx page that can take a long time to load depending on where in the world you are calling it from. I want to put up a Please wait loading message while the page is loading.
The issue is in the aspx.cs file function Page_Load(object sender, EventArgs e) I do a lot of data access to populate the drop downs in the form. This can take a while to do some times. When this is happening the use sees a blank page.
I have searched and searched and tried three different ways but they have all failed. See below.
If anyone has been able to do this please help. thank you
ATTEMPT 1
Calling window.onload = waitPreloadPage();
Loads the Loading ... message and it does go to my page_load in the aspx.cs file but then it does not refresh my page with the other controls.
I am stuck with the loading message
Also
- throws and error in FF (document.getElementById("prepage" is null
function waitPreloadPage() { //DOM
if (document.getElementById){
document.getElementById('prepage').style.visibility='hidden';
}else
{
if (document.layers)
{ //NS4
document.prepage.visibility = 'hidden';
}
else
{ //IE4
document.all.prepage.style.visibility = 'hidden';
}
}
}
window.onload = waitPreloadPage();
</script>
</head>
<body id="bodyTimeTable" bgcolor="#D7e1e1">
<form id="form1" runat="server">
<div id="prepage" style="position:absolute; font-family:arial; font-size:16; left:0px; top:0px; background-color:white; layer-background-color:white; height:100%; width:100%;">
<table width="100%"><tr><td><b>Loading ... ... Please wait!</b></td></tr></table>
</div>
<asp:UpdatePanel ID="updateStationPanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table cellpadding="2" cellspacing="0" border="0" class="wrapper">
<tr>
<td valign="top">
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td colspan="2">
....
ATTEMPT TWO
Call the javascript from the body onLoad.
If I put an alert in the waitpreloadpage function, I see the loading message and then it loads the Loading message, says the alert and loads the
other controls. The issue is if I do not put alert in, I do not see the loading message.
I have moved this code out to a network site where I know the page load in the .aspx.cs file will take a while and I just see a blank screen until I get the regular controls
I still get the
- throws and error in FF (document.getElementById("prepage" is null
function waitPreloadPage() { //DOM
if (document.getElementById){
document.getElementById('prepage').style.visibility='hidden';
}else
{
if (document.layers)
{ //NS4
document.prepage.visibility = 'hidden';
}
else
{ //IE4
document.all.prepage.style.visibility = 'hidden';
}
}
}
</script>
</head>
<body onload="javascript:waitPreloadPage();" id="bodyTimeTable" bgcolor="#D7e1e1">
<form id="form1" runat="server">
<div id="prepage" style="position:absolute; font-family:arial; font-size:16; left:0px; top:0px; background-color:white; layer-background-color:white; height:100%; width:100%;">
<table width="100%"><tr><td><b>Loading ... ... Please wait!</b></td></tr></table>
</div>
<asp:UpdatePanel ID="updateStationPanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table cellpadding="2" cellspacing="0" border="0" class="wrapper">
<tr>
<td valign="top">
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td colspan="2">
....
ATTEMPT 3.
I created an ASP page that puts up a please wait graphic and message up, on its load I call a function that will load my other page that takes a while to load some time.
I never see the graphic or loading, it immediately goes to the other page which is blank until everything is loaded.
<html>
<body bgcolor="#ffffff" onLoad="search_flights()">
<center><img src="Images\wait2.gif"><br>
<font size="4" face="Arial" color=#000060>Searching for flights - please wait...</font>
</center>
<form method="post">
</form>
</body>
<script language="JavaScript">
function search_flights()
{
document.forms[0].target="Results";
document.forms[0].action = "default.aspx?show=MAP";
document.forms[0].submit();
}
</script>
The issue is in the aspx.cs file function Page_Load(object sender, EventArgs e) I do a lot of data access to populate the drop downs in the form. This can take a while to do some times. When this is happening the use sees a blank page.
I have searched and searched and tried three different ways but they have all failed. See below.
If anyone has been able to do this please help. thank you
ATTEMPT 1
Calling window.onload = waitPreloadPage();
Loads the Loading ... message and it does go to my page_load in the aspx.cs file but then it does not refresh my page with the other controls.
I am stuck with the loading message
Also
- throws and error in FF (document.getElementById("prepage" is null
function waitPreloadPage() { //DOM
if (document.getElementById){
document.getElementById('prepage').style.visibility='hidden';
}else
{
if (document.layers)
{ //NS4
document.prepage.visibility = 'hidden';
}
else
{ //IE4
document.all.prepage.style.visibility = 'hidden';
}
}
}
window.onload = waitPreloadPage();
</script>
</head>
<body id="bodyTimeTable" bgcolor="#D7e1e1">
<form id="form1" runat="server">
<div id="prepage" style="position:absolute; font-family:arial; font-size:16; left:0px; top:0px; background-color:white; layer-background-color:white; height:100%; width:100%;">
<table width="100%"><tr><td><b>Loading ... ... Please wait!</b></td></tr></table>
</div>
<asp:UpdatePanel ID="updateStationPanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table cellpadding="2" cellspacing="0" border="0" class="wrapper">
<tr>
<td valign="top">
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td colspan="2">
....
ATTEMPT TWO
Call the javascript from the body onLoad.
If I put an alert in the waitpreloadpage function, I see the loading message and then it loads the Loading message, says the alert and loads the
other controls. The issue is if I do not put alert in, I do not see the loading message.
I have moved this code out to a network site where I know the page load in the .aspx.cs file will take a while and I just see a blank screen until I get the regular controls
I still get the
- throws and error in FF (document.getElementById("prepage" is null
function waitPreloadPage() { //DOM
if (document.getElementById){
document.getElementById('prepage').style.visibility='hidden';
}else
{
if (document.layers)
{ //NS4
document.prepage.visibility = 'hidden';
}
else
{ //IE4
document.all.prepage.style.visibility = 'hidden';
}
}
}
</script>
</head>
<body onload="javascript:waitPreloadPage();" id="bodyTimeTable" bgcolor="#D7e1e1">
<form id="form1" runat="server">
<div id="prepage" style="position:absolute; font-family:arial; font-size:16; left:0px; top:0px; background-color:white; layer-background-color:white; height:100%; width:100%;">
<table width="100%"><tr><td><b>Loading ... ... Please wait!</b></td></tr></table>
</div>
<asp:UpdatePanel ID="updateStationPanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table cellpadding="2" cellspacing="0" border="0" class="wrapper">
<tr>
<td valign="top">
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td colspan="2">
....
ATTEMPT 3.
I created an ASP page that puts up a please wait graphic and message up, on its load I call a function that will load my other page that takes a while to load some time.
I never see the graphic or loading, it immediately goes to the other page which is blank until everything is loaded.
<html>
<body bgcolor="#ffffff" onLoad="search_flights()">
<center><img src="Images\wait2.gif"><br>
<font size="4" face="Arial" color=#000060>Searching for flights - please wait...</font>
</center>
<form method="post">
</form>
</body>
<script language="JavaScript">
function search_flights()
{
document.forms[0].target="Results";
document.forms[0].action = "default.aspx?show=MAP";
document.forms[0].submit();
}
</script>