I am using a asp:Timer control to poll a service every 10 seconds.
I know the timer is working as if I comment out the service call the time will update the panel perfectly.
However when the service call is enabled the timer will update the panel a few times correctly but then it will start to hang.
I believe it's due to a bottle neck at the service side but the service just returns a list of projects.
Here is the code in each level:
ASP.Net
<asp:UpdatePanel ID="pnlProjectList" runat="server">
<ContentTemplate>
<asp:Timer id="updateTimer" Interval="10000" runat="server"
ontick="updateTimer_Tick">
</asp:Timer>
C# page code behind
public partial class Controls_ProjectList : System.Web.UI.UserControl, IProjectListView
{
ProjectListPresenter presenter;
protected void Page_Load(object sender, EventArgs e)
{
presenter = new ProjectListPresenter(this);
if (!IsPostBack)
{
presenter.GetProjects();
lbUpdateTime.Text = "Updated at " + DateTime.Now.ToLongTimeString();
}
}
public ProjectTable ProjectList
{
set {
dlProjectList.DataSource = value.Projects;
dlProjectList.DataBind();
}
}
protected void updateTimer_Tick(object sender, EventArgs e)
{
try
{
presenter.GetProjects();
lbUpdateTime.Text = "Updated at " + DateTime.Now.ToLongTimeString();
}
catch (TimeoutException ex)
{
}
}
}
Can anyone advise me on A)what I'm doing wrong or B)the best practices for doing what I am trying to do.
Thanks.