tags:

views:

75

answers:

2

asp.net
c#

Our webpage currently contains a rather large web app which causes a lengthy delay when attemping to navigate to it. I'm currently implementing a WCF web service to utilize ajax but the delay is a concern to my employer so he wanted a quick and dirty fix in the mean time.

I would like to have the empty page load and then use a timer to load the content. This will cut down on perceived page load time but i'm unsure how to accomplish it.

Any help would be much appreciated

Shawn

A: 

Instead of a timer, you could flush the Response with Response.Flush().

Daniel A. White
A: 

Some code to get you started:

In the asp.net page:

<asp:Timer ID="Timer1" OnTick="Timer1_Tick" runat="server" Interval="1">
</asp:Timer>
<asp:UpdatePanel ID="updatePanel1" runat="server" UpdateMode="Conditional">
  <Triggers>
    <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
  </Triggers>
  <ContentTemplate>
    .... your stuff here
  </ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="100">
  <ProgressTemplate>
    Please wait...
  </ProgressTemplate>
</asp:UpdateProgress>

In the code behind:

protected void Timer1_Tick(object sender, EventArgs e)
{
  this.Timer1.Enabled = false;
  StartLongRunningTask();                            
}
edosoft