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" %>
    04. 
    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>
    10. 
    11. 
    12.<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    13.    <script type="text/javascript">
    14.        function responseEnd(sender, eventArgs) {
    15.            alert("response");
    16.            }
    17.    </script>
    18.</telerik:RadCodeBlock>
    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" />
    49. 
    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>
    53.     
    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>
    58.</form>
    59.</body>
    60.</html>

    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;
    07. 
    08.public partial class Default2 : System.Web.UI.Page
    09.{
    10.    protected void Page_Load(object sender, EventArgs e)
    11.    {
    12. 
    13.    }
    14. 
    15.    protected void ddlPartNumber_Click(object sender, EventArgs e)
    16.    {
    17. 
    18.    }
    19.}

    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
    Admin
    Angel Petrov avatar
    1007 posts

    Posted 22 Dec 2014 Link to this post

    Hello,

    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.

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


    Regards,
    Angel Petrov
    Telerik
     

    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.

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