Chaining OnRequestStart and OnResponseEnd handlers

2 posts, 0 answers
  1. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 09 Jun 2011 Link to this post

    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
  2. Fortune
    Fortune avatar
    5 posts
    Member since:
    Jun 2011

    Posted 09 Jun 2011 Link to this post

    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

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top