Thursday, March 22, 2012

Wait while loading.....

How can i show a "Wait while loading..." text on my aspx page while loading
data into a datagrid from a database.

/JonasYou pretty much can't as you cannot control what the browser shows to the
user while it's loading a page. There are some things you can do (use a
redirect page or send part of the response first by flushing the response
object) but none are 100% guaranteed to work.

Jerry

"Jonas Nilsson" <jonas_nilsson@.hotmail.com> wrote in message
news:%23zfCV9tlDHA.2444@.TK2MSFTNGP09.phx.gbl...
> How can i show a "Wait while loading..." text on my aspx page while
loading
> data into a datagrid from a database.
> /Jonas
You pretty much can't as you cannot control what the browser shows to the
user while it's loading a page. There are some things you can do (use a
redirect page or send part of the response first by flushing the response
object) but none are 100% guaranteed to work.

Jerry

"Jonas Nilsson" <jonas_nilsson@.hotmail.com> wrote in message
news:%23zfCV9tlDHA.2444@.TK2MSFTNGP09.phx.gbl...
> How can i show a "Wait while loading..." text on my aspx page while
loading
> data into a datagrid from a database.
> /Jonas
I just had the same requirement and it works great:

sub Page_Load()
Response.Write("<br><div align='center' id=myMessage style='font-family
Tahoma; font-size: 18; color:Red'>Loading report, please wait...</div>")
Response.flush
End Sub

sub DisplayReport()

'-- code that reads database here....

End Sub

<html>
<head>
</head>
<body onload="clearWaitMessage();" >
<center>
<p
<%Call DisplayReport%>
</p
</center>
</body>
</html
<SCRIPT LANGUAGE=JavaScript>
<!--function clearWaitMessage() {
myMessage.innerHTML = "";
}
//-->
</SCRIPT
"Jonas Nilsson" <jonas_nilsson@.hotmail.com> wrote in message
news:%23zfCV9tlDHA.2444@.TK2MSFTNGP09.phx.gbl...
> How can i show a "Wait while loading..." text on my aspx page while
loading
> data into a datagrid from a database.
> /Jonas
I just had the same requirement and it works great:

sub Page_Load()
Response.Write("<br><div align='center' id=myMessage style='font-family
Tahoma; font-size: 18; color:Red'>Loading report, please wait...</div>")
Response.flush
End Sub

sub DisplayReport()

'-- code that reads database here....

End Sub

<html>
<head>
</head>
<body onload="clearWaitMessage();" >
<center>
<p
<%Call DisplayReport%>
</p
</center>
</body>
</html
<SCRIPT LANGUAGE=JavaScript>
<!--function clearWaitMessage() {
myMessage.innerHTML = "";
}
//-->
</SCRIPT
"Jonas Nilsson" <jonas_nilsson@.hotmail.com> wrote in message
news:%23zfCV9tlDHA.2444@.TK2MSFTNGP09.phx.gbl...
> How can i show a "Wait while loading..." text on my aspx page while
loading
> data into a datagrid from a database.
> /Jonas

0 comments:

Post a Comment