Thanks for Weston's informative suggestions.
Hi Brian,
Generaly we can use javascript function to display some waiting message on
the page when there is a long run task being processed at the serverside
when the page is posted back. Here is a simple demo page:
============aspx page===============
<HTML>
<HEAD>
<title>showwaitmsg</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<script language="javascript">
function initialProgress()
{
document.getElementById("divProgress").innerText = "Uploading...";
window.setInterval("addDots();",500);
}
function addDots()
{
document.getElementById("divProgress").innerText =
document.getElementById("divProgress").innerText + ".";
}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<table width="100%" align="center">
<tr>
<td><INPUT id="fpMain" type="file" name="File1" runat="server">
<asp:Button id="btnUpload" runat="server" Text="Upload"></asp:Button>
</td>
</tr>
<tr>
<td>
<div id="divProgress" />
</td>
</tr>
</table>
</form>
</body>
</HTML>
==========code behind================
public class showwaitmsg : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button btnUpload;
protected System.Web.UI.HtmlControls.HtmlInputFile fpMain;
private void Page_Load(object sender, System.EventArgs e)
{
btnUpload.Attributes.Add("onclick","initialProgres s();");
}
#region Web
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.btnUpload.Click += new System.EventHandler(this.btnUpload_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void btnUpload_Click(object sender, System.EventArgs e)
{
try
{
if(fpMain.PostedFile != null)
{
string filename =
System.IO.Path.GetFileName(fpMain.PostedFile.FileN ame);
Response.Write("<br>" + filename + " is uploaded!");
System.Threading.Thread.Sleep(3* 1000);
}
}
catch(Exception ex)
{
Response.Write("<br>" + ex.Message);
}
}
}
=========================================
In addition, here are some other tech articles discussing the similar
topics:
#How to show progress in the client browser for a long-running ASP.NET page
http://support.microsoft.com/?id=837375
#DESIGN PATTERNS: Asynchronous Wait State Pattern in ASP.NET
http://msdn.microsoft.com/msdnmag/is...s/default.aspx http://www.aspnetpro.com/NewsletterA..._l/asp200308bm
_l.asp
Hope also helps. Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)