Ajax event OnResponseEnd on a user control

2 posts, 0 answers
  1. David
    David avatar
    12 posts
    Member since:
    Oct 2014

    Posted 17 Dec 2014 Link to this post

    Hi guys, I've a problem with an ajax request and a user control
    I've this aspx page
    01.<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
    02.<%@ Register Src="~/res/controls/gen/combo_missions.ascx" TagName="combo_missions" TagPrefix="ias" %>
    03.<%@ Register Assembly="Integra" Namespace="Integra" TagPrefix="cc1" %>
    05.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    07.<head id="Head1" runat="server">
    08.    </head>
    09.    <body>
    12.<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    13.    <script type="text/javascript">
    14.        function responseEnd(sender, eventArgs) {
    15.            alert("response");
    16.            }
    17.    </script>
    19.<form id="form1" runat="server">
    20.    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    21.        <Scripts>
    22.            <asp:ScriptReference Path="~/res/scripts/ias.js" />
    23.        </Scripts>
    24.    </telerik:RadScriptManager>
    25.    <telerik:RadFormDecorator ID="FormDecorator1" runat="server" DecoratedControls="all"
    26.        ControlsToSkip="Scrollbars"></telerik:RadFormDecorator>
    27.    <telerik:RadAjaxManager ID="RadAjaxManager" runat="server"
    28.        DefaultLoadingPanelID="RadAjaxLoadingPanel1">
    29.        <AjaxSettings>
    30.            <telerik:AjaxSetting AjaxControlID="RadAjaxManager">
    31.                <UpdatedControls>
    32.                    <telerik:AjaxUpdatedControl ControlID="ddlPartNumber" />
    33.                    <telerik:AjaxUpdatedControl ControlID="ddlMission" />
    34.                </UpdatedControls>
    35.            </telerik:AjaxSetting>
    36.            <telerik:AjaxSetting AjaxControlID="ddlPartNumber">
    37.                <UpdatedControls>
    38.                    <telerik:AjaxUpdatedControl ControlID="ddlPartNumber" />
    39.                </UpdatedControls>
    40.            </telerik:AjaxSetting>
    41.            <telerik:AjaxSetting AjaxControlID="ddlMission">
    42.                <UpdatedControls>
    43.                </UpdatedControls>
    44.            </telerik:AjaxSetting>
    45.        </AjaxSettings>
    46.        <ClientEvents OnResponseEnd="responseEnd" />
    47.    </telerik:RadAjaxManager>
    48.    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" EnableEmbeddedSkins="false" Skin="custom" />
    50.    <ias:combo_missions ID="ddlMission" Required="true" ValidationGroup="vgForm" runat="server"
    51.        AutoPostBack="true" IdAircraft="6"></ias:combo_missions>
    52.    <telerik:RadButton runat="server" ID="ddlPartNumber" OnClick="ddlPartNumber_Click"></telerik:RadButton>
    54.    <telerik:RadWindowManager ID="rwm" RegisterWithScriptManager="true" VisibleOnPageLoad="true"
    55.        KeepInScreenBounds="true" VisibleStatusbar="false" Modal="true" Behaviors="Close,Move, Resize"
    56.        runat="server" EnableShadow="true">
    57.    </telerik:RadWindowManager>

    With this cs
    01.using System;
    02.using System.Collections.Generic;
    03.using System.Linq;
    04.using System.Web;
    05.using System.Web.UI;
    06.using System.Web.UI.WebControls;
    08.public partial class Default2 : System.Web.UI.Page
    10.    protected void Page_Load(object sender, EventArgs e)
    11.    {
    13.    }
    15.    protected void ddlPartNumber_Click(object sender, EventArgs e)
    16.    {
    18.    }

    Now I would like to catch the onResponseEnd ajax request event, but if i click on the button the event occur, instead if I use the user control "combo_mission" the request start but the event is not raised

    There is a reason?

    P.S.: Sorry for my very poor english
  2. Angel Petrov
    Angel Petrov avatar
    1044 posts

    Posted 22 Dec 2014 Link to this post


    I am experiencing difficulties understanding the issue. If I am correct a control inside the user control triggers an AJAX request but in this case the OnResponseEnd event is not raised. Is this the exact scenario?
    Could you please share with us the markup and code-behind of the user control as well?

    Additionally please elaborate more on the relation between the user control and the other controls on the page. Since it seems to fire the AJAX request it should probably update some of them. If it should update itself I recommend modifying the AJAX settings as demonstrated below.

    <telerik:RadAjaxManager ID="RadAjaxManager" runat="server"
               <telerik:AjaxSetting AjaxControlID="RadAjaxManager">
                       <telerik:AjaxUpdatedControl ControlID="ddlPartNumber" />
                       <telerik:AjaxUpdatedControl ControlID="ddlMission" />
               <telerik:AjaxSetting AjaxControlID="ddlPartNumber">
                       <telerik:AjaxUpdatedControl ControlID="ddlPartNumber" />
               <telerik:AjaxSetting AjaxControlID="ddlMission">
                       <telerik:AjaxUpdatedControl ControlID="ddlMission" />
           <ClientEvents OnResponseEnd="responseEnd" />

    Angel Petrov

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top