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

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

2 Answers 235 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Denis
Top achievements
Rank 1
Denis asked on 11 Nov 2010, 08:42 PM
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 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 12 Nov 2010, 01:46 PM
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
0
Denis
Top achievements
Rank 1
answered on 12 Nov 2010, 08:58 PM
Thank you,
this worked!
Tags
Ajax
Asked by
Denis
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Denis
Top achievements
Rank 1
Share this question
or