Polling with two UpdatePanels

Posted by: Atlas notes, on 04 Dec 2006 | View original | Bookmarked: 0 time(s)

Live Demo    Source Code

While browsing the ASP.NET Forums I came to a thread with a request for implementing a polling scheme with two UpdatePanels.

In the specific scenario, we have a Timer control (Timer1) that is acting as a trigger for two UpdatePanels, let's say UpdatePanel1 and UpdatePanel2.

While UpdatePanel1 is always polling based on the time interval set on Timer1, UpdatePanel2 starts polling only when a button is clicked inside UpdatePanel1. Similarly, clicking another button stops UpdatePanel2 from updating.

You may want to look at the live demo to better understand the requirement.

The first thing I thought was to programmatically add and remove from the second UpdatePanel the trigger pointing to Timer1 but this is not the best approach because a dynamic trigger should be added on every request and this leads to very ugly code.

In the implementation, I've used a single trigger in UpdatePanel1 pointing to Timer1 and a server side flag called EnablePolling to determine if UpdatePanel2 is polling. Then, in the Tick event handler for Timer1, UpdatePanel2 is programmatically updated with a call to the Update method.

Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!

Advertisement
Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.
Category: Ajax | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 1083 | Hits: 36

Similar Posts

  • WebUI Studio.NET 2008 R2 is now official more
  • Displaying Detail Records for User-Selected Master Records :: Using a Dynamic IN Clause more
  • Why I Love F#: Breaking Up Tuples more
  • Callbacks, ConcurrencyMode and Windows Clients more
  • How ADO.NET vNext bridges the Conceptual Model and the Logical Model. more
  • Tips for Nested Master Pages and VS 2005 Design-Time more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD