RadAjaxManager causing events to fire incorrectly

3 posts, 0 answers
  1. EmpowerIT
    EmpowerIT avatar
    117 posts
    Member since:
    Jun 2007

    Posted 25 Aug 2010 Link to this post

    I have a page that is using a RadAjaxManager to update some controls on the page. The controls that get updated can either be visible or not depending on some condition when the page is first loaded. The RadAjaxManager however still lists both of the controls as being p[art of the updated controls. I have found that if an invisible control is part of the updated controls, the AjaxControl for which it belongs will be incorreclty fired on the second postback, even though no event has been raised. Below is a simple page reproducing the problem (i took a while to track it down!)

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="FayezTest.aspx.cs" Inherits="Utilities_FayezTest" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head runat="server">
        <form id="form1" runat="server">
        <asp:ScriptManager ID="script1" runat="server">
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                <telerik:AjaxSetting AjaxControlID="WorkClassificationValue">
                        <telerik:AjaxUpdatedControl ControlID="WorkClassificationValue" />
                        <telerik:AjaxUpdatedControl ControlID="EmployeeValue" />
                        <telerik:AjaxUpdatedControl ControlID="SitesValue" />
                <telerik:AjaxSetting AjaxControlID="EmployeeValue">
                        <telerik:AjaxUpdatedControl ControlID="EmployeeValue" />
                        <telerik:AjaxUpdatedControl ControlID="Test" />
            <telerik:RadComboBox ID="WorkClassificationValue" runat="server" CssClass="DatabaseFieldName"
                AutoPostBack="true" Width="100%" AllowCustomText="true">
                <CollapseAnimation Duration="200" Type="OutQuint" />
                <ExpandAnimation Type="OutQuart" />
            <asp:Panel ID="EmployeeSection" runat="server" Visible="false">
                <table class="DatabaseField" id="Table2" runat="server">
                        <td class="DatabaseFieldLeft">
                            <asp:Label ID="Label3" Text="Add Employees:" runat="server" CssClass="" />
                        <td class="DatabaseFieldRight">
                            <telerik:RadComboBox ID="EmployeeValue" runat="server" AutoPostBack="true" Width="100%"
                                ShowToggleImage="True" ShowMoreResultsBox="true" EnableVirtualScrolling="true"
                                Height="120px" AllowCustomText="true" EmptyMessage="Please type or select employee name">
                                <CollapseAnimation Duration="200" Type="OutQuint" />
                                <ExpandAnimation Type="OutQuart" />
                <br />
            <asp:Panel ID="SiteSection" runat="server">
                <telerik:RadComboBox ID="SitesValue" runat="server">
            <asp:Label ID="Test" runat="server"></asp:Label>

    This is the code behind:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using LogicRoster.Business;
    using Telerik.Web.UI;
    using EmpowerIT.Applications;
    using System.Collections;
    public partial class Utilities_FayezTest : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)
            EmployeeValue.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(EmployeeValue_SelectedIndexChanged);
            WorkClassificationValue.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(WorkClassificationValue_SelectedIndexChanged);
               EmployeeSection.Visible = true;
               SiteSection.Visible = false;
               WorkClassificationValue.Items.Add(new RadComboBoxItem("Item #1", "1"));
               WorkClassificationValue.Items.Add(new RadComboBoxItem("Item #2", "2"));
               WorkClassificationValue.Items.Add(new RadComboBoxItem("Item #3", "3"));
               EmployeeValue.Items.Add(new RadComboBoxItem("Item 1", "1"));
               EmployeeValue.Items.Add(new RadComboBoxItem("Item 2", "2"));
               EmployeeValue.Items.Add(new RadComboBoxItem("Item 3", "3"));
        void WorkClassificationValue_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
            EmployeeValue.Text = "";
        void EmployeeValue_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
            Test.Text += String.Format("Selected value is: '{0}'<br/>", e.Value);

    As you can see, in the Page_Load event, I intially set the SiteSection.Visible property to false. However, the control in this section, SiteValue, is listed as an item that will be updated by WorkClassificationValue. In this example it is not updated at all, however its updated was goverened by wether or not the section it was in was visible. If you select an item from the WorkClassificationCombo, and then select an item from the EmployeeCombo, you will notice that on the post back for the EmployeeCombo, the WorkClassificationValue_SelectedIndexChanged will fire incorrectly and end up clearing the selected value for the EmployeeValue combo.
    If i remove the RadAjaxManager and use full postbacks, everything behaves as expected. Also, if set the SiteSection.Visible property to true, everything also behaves as expected.

    Could someone please help or let me know if this is expected behavior or a known bug.

  2. EmpowerIT
    EmpowerIT avatar
    117 posts
    Member since:
    Jun 2007

    Posted 25 Aug 2010 Link to this post

    I should point out that I am using the 2010.2.713.40 version of the Telerik.Web.UI dll (.NET 4)
  3. Iana Tsolova
    Iana Tsolova avatar
    3388 posts

    Posted 31 Aug 2010 Link to this post

    Hi EmpowerIT,

    Indeed, it is not suggested to add invisible controls to the ajax settings. Therefore I suggest that you either set the ASP:Panel wrapped around the invisible ComboBox as UpdatedControl in the ajax settings. Or add a dynamical ajax setting for the ComboBox only for the cases when it is visible.

    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
Back to Top