This is a migrated thread and some comments may be shown as answers.

Chaining OnRequestStart and OnResponseEnd handlers

1 Answer 60 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Stuart Hemming
Top achievements
Rank 2
Stuart Hemming asked on 09 Jun 2011, 08:35 AM
I have a project were we have the RadAjaxManager on the MasterPage. The MasterPage declares functions that are attached to the RadAjaxManager's OnRequestStart and OnResponseEnd client events.

No problem so far.

On an individual page in the project I find myself needing to assign a function to the OnResponseEnd event. If I do this, I'm going to lose the regular handler for that page, aren't I?

Is there a properly defined way of chaining these handlers?

-- 
Stuart

1 Answer, 1 is accepted

Sort by
0
Fortune
Top achievements
Rank 1
answered on 09 Jun 2011, 07:12 PM
Indeed the second function will override the handler from the MaterPage, however into the second handler you could call explicitly the function from the master page. For example:
MasterPage:
<telerik:RadAjaxManager ClientEvents-OnResponseEnd="OnResponseEnd" runat="server"></telerik:RadAjaxManager>
<telerik:RadCodeBlock runat="server">
        <script type="text/javascript">
            function OnResponseEnd(sender, eventArgs)
            {
                alert("OnResponseEnd function is called");
            }
        </script>
    </telerik:RadCodeBlock>

Content page:
protected override void OnLoad(EventArgs e)
   {
       base.OnLoad(e);
       (RadAjaxManager.GetCurrent(Page) as RadAjaxManager).ClientEvents.OnResponseEnd = "onResEnd";
   }
<telerik:RadScriptBlock runat="server">
        <script type="text/javascript">
            function onResEnd(sender,eventArgs)
            {
                alert("onResEnd function is called");
                OnResponseEnd(sender,eventArgs);
            }
        </script>
    </telerik:RadScriptBlock>

Regards,
F

Tags
Ajax
Asked by
Stuart Hemming
Top achievements
Rank 2
Answers by
Fortune
Top achievements
Rank 1
Share this question
or