Decouple initiator and updated controls from the RadAjaxManager by using ASP.NET event bubbling

5 posts, 0 answers
  1. Hristo Deshev
    Hristo Deshev avatar
    16 posts
    Member since:
    May 2004

    Posted 17 Aug 2006 Link to this post


    r.a.d.controls version

    Q2 2006 SP1 or later

    .NET version

    2.0, but it can be reworked for 1.x too

    Visual Studio version


    programming language


    browser support

    all browsers supported by r.a.d.controls


    Some business cases require building a loosely coupled web site that has to be able to trigger AJAX requests from one area and update that area and/or various other areas depending on some conditions.  You can achieve that with only one RadAjaxManager on your page that will have its AjaxSettings configured dynamically.  There are three tricky moments in such cases:
    • describing which control will update which other controls
    • finding the initiator and updated controls and adding ajax settings for them
    • finding a control to update inside a user control since user controls are not updateable

    The examle here loads two user controls.  Both implement a simple interface that can be used to get a control that will be updated with Ajax -- an inner <asp:Panel> in our case.  That solves the third problem.  The second problem can be solved by bubbling events from the control and handling them on the page.  We use two event names: RegisterUpdatableControl that will add an AjaxSetting used to update the control itself; AreaUpdate -- just a name that is used to distinguish when to add AjaxSettings for the other area controls.  This can be used to implement the rules mentioned above -- you can use the initiator control and command name to define different AjaxSettings that suit your needs.

    Here is the list of the most interesting parts of the code:

    • The IUpdatableControl interface and its implementation in the user control that returns the inner panel.
    • The RaiseBubbleCommand call in the user control Page_Load event that registers the control for Ajax.
    • The RaiseBubbleCommand in the Button2_Click event handler that will request updating both controls.  Normally, only one of the controls will be updated.
    • The OnBubbleEvent page method override that adds the AjaxSettings according to the initiator control and event name.

  2. Shane Manaton
    Shane Manaton avatar
    26 posts
    Member since:
    May 2006

    Posted 23 Aug 2006 Link to this post

    Hi, the zip seems to be empty,i would really like to see the code
  3. Natalie Farah
    Natalie Farah avatar
    170 posts

    Posted 24 Aug 2006 Link to this post

    Hello Shane,

    There was a glitch in our live server that is already fixed. Now you should be able to download the file correctly.

    Please excuse us for the inconvenience we might have caused you.

    Best wishes,
    Natalie Farah
    the telerik team
  4. Jason
    Jason avatar
    68 posts
    Member since:
    Feb 2005

    Posted 05 Apr 2007 Link to this post

    Is there anyway to get this in 1.1?

  5. Chuanbo
    Chuanbo avatar
    32 posts
    Member since:
    Jul 2007

    Posted 23 Jul 2007 Link to this post

    this is just works fine in normal page and usercontrol.what about the ajax manager in master page and want to loosely coupled update control in content page.Since the master page is not the parent page of the content page,the OnBubbleEvent is not invoked,so this doesnt work.
Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.