I have a page that is hitting a webservice every 5 seconds to update the information on the page. I’m using the DynamicPopulateExtender from the Ajax Control Toolkit to just populate a panel with some text.
What I was wanting to do, is if a certain condition is met, to refresh the page completely.
Am I going to be able to do this in the current method that I have? here’s my current stuff:
ASP.NET
<cc1:DynamicPopulateExtender ID='DynamicPopulateExtender1' runat='server' ClearContentsDuringUpdate='true' TargetControlID='panelQueue' BehaviorID='dp1' ServiceMethod='GetQueueTable' UpdatingCssClass='dynamicPopulate_Updating' />
Javascript
Sys.Application.add_load(function(){updateQueue();}); function updateQueue() { var queueShown = document.getElementById('<%= hiddenFieldQueueShown.ClientID %>').value; if(queueShown == 1) { var behavior = $find('dp1'); if (behavior) { behavior.populate(); setTimeout('updateQueue()', 5000); } } }
SERVER (C#)
[System.Web.Services.WebMethod] [System.Web.Script.Services.ScriptMethod] public static string GetQueueTable() { System.Text.StringBuilder builder = new System.Text.StringBuilder(); try { // do stuff } catch (Exception ex) { // do stuff } return builder.ToString(); }
1 Answer