RadAjaxManager's ClientEvents are not fired when ajaxifyed user control initiates ajax post back.

3 posts, 0 answers
  1. Denis
    Denis avatar
    18 posts
    Member since:
    Feb 2009

    Posted 11 Nov 2010 Link to this post

    Can't understand why RadAjaxManager's ClientEvents are not fired when Ajax post back is initiated by ajaxifyed usercontrol. Please see the following test project:
    default.aspx:
    <form id="form1" runat="server">
    <asp:ScriptManager runat="server" ID="ScriptManager1">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
    </asp:ScriptManager>
    <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="SubmitBtn">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="TextItemView" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
        <ClientEvents OnResponseEnd="OnAjaxRequestStop" />
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1">
    </telerik:RadAjaxLoadingPanel>
     
    <script type="text/javascript">
        function OnAjaxRequestStop(sender, args) {
            alert('OnAjaxRequestStop');
        }
    </script>
     
    <div>
        Test project    <br /><br />
        <hr />
        <WW:TextItem runat="server" ID="TextItemView" />
        <hr />
        <br />
        <asp:Button ID="SubmitBtn" runat="server" Text="Submit" />
        <br />
        When you click on outer submit btn OnAjaxRequestStop event fires as expected (see alert msg).<br />
        When you click on inner submit btn client side event funtion is not called but ajax postback is innitiated...
    </div>
    </form>

    usercontrol TextItem.ascx:
    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="TextItem.ascx.cs" Inherits="TextItem" %>
    User control content: <br />
    <asp:Label runat="server" ID="Counter" /> <br />
    <asp:Button ID="InnerSubmitBtn" runat="server" Text="Control's Submit" OnClick="Btn_OnClick" />

    That is pretty much it, when I click InnerSubmitBtn,OnAjaxRequestStop function is not being called. But Ajax request happens (I check it using counter label that is incremented in OnClick method). Please let me know where is my assumptions are wrong. The task is: I need to know when ajax request ends when InnerSubmitBtn is clicked.

    Thank you,
    Denis.
  2. Radoslav
    Admin
    Radoslav avatar
    1566 posts

    Posted 12 Nov 2010 Link to this post

    Hello Denis,

    To achieve the desired functionality you need to add the RadAjaxManagerProxy into the user control which ajaxify the InnerSubmitBtn:
    <telerik:RadAjaxManagerProxy runat="server" ID="RadAjaxManagerProxy1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="InnerSubmitBtn">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="InnerSubmitBtn" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>
     
    User control content: <br />
    <asp:Label runat="server" ID="Counter" /> <br />
    <asp:Button ID="InnerSubmitBtn" runat="server" Text="Control's Submit" OnClick="Btn_OnClick" />

    Additionally I am sending you a simple example based on your code.

    Kind regards,
    Radoslav
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Denis
    Denis avatar
    18 posts
    Member since:
    Feb 2009

    Posted 12 Nov 2010 Link to this post

    Thank you,
    this worked!
Back to Top