We have been trying to render a progress meter using Ajax but have failed due to a conflict with Component Art controls so I now need to look at an alternative solution.
What I would like to do is render an animated gif down to the client before any processing begins. The following is a sample test page:
Unfortunately this doesn't render the image until the page has finished processing. Any ideas how I can force the browser to download and render this image whilst waiting for the server to finish processing.
TIA
Smeat
What I would like to do is render an animated gif down to the client before any processing begins. The following is a sample test page:
Code:
public partial class Page2 : System.Web.UI.Page
{
protected override void OnInit(EventArgs e)
{
RenderProgressMeter();
if (!Page.IsPostBack)
{
//Simulate a long running process.
System.Threading.Thread.Sleep(3000);
}
lblMessage.Text = "Page 2";
base.OnInit(e);
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("Default.aspx");
}
private void RenderProgressMeter()
{
string output = "<img src='" + ResolveUrl("Images/loadingstrip.gif") + "' alt='Progress Meter' />";
System.Text.ASCIIEncoding encoder = new System.Text.ASCIIEncoding();
byte[] outputBytes = encoder.GetBytes(output);
Response.OutputStream.Write(outputBytes, 0, outputBytes.Length);
Response.OutputStream.Flush();
}
}
Unfortunately this doesn't render the image until the page has finished processing. Any ideas how I can force the browser to download and render this image whilst waiting for the server to finish processing.
TIA
Smeat