RadCombobox client events don't work after ajax update

2 posts, 0 answers
  1. Nick Foscolos
    Nick Foscolos avatar
    1 posts
    Member since:
    Oct 2005

    Posted 15 Feb 2011 Link to this post

    The code below shows two RadComboBox instances. The first is configured and bound within PageLoad. The second is bound within an AJAX request.

    Javascript and styles work fine on both comboboxes before clicking on the button. After clicking on btnShow the second combo box has the expected data, but, styling and client side response is disabled.

    What am I doing wrong?

    ASPX file
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default2" %>
      
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
          <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
                <Scripts>
                    <%--Needed for JavaScript IntelliSense in VS2010--%>
                    <%--For VS2008 replace RadScriptManager with ScriptManager--%>
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                </Scripts>
            </telerik:RadScriptManager>
          <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
              <telerik:AjaxSetting AjaxControlID="btnShow">
                <UpdatedControls>
                  <telerik:AjaxUpdatedControl ControlID="ajaxPanel1" LoadingPanelID="radLoadingPanel" />
                </UpdatedControls>
              </telerik:AjaxSetting>
            </AjaxSettings>
          </telerik:RadAjaxManager>
      
          Populated in Page Load
          <hr />
          <telerik:RadComboBox ID="cbPageLoad" runat="server" Width="300"></telerik:RadComboBox>
      
          <p> </p>
          <p> </p>
            <asp:Button runat="server" ID="btnShow" Text="Populate From Ajax Call" 
              OnClick="btnShow_Click" />
          <hr />
      
          <div>
            <telerik:RadAjaxLoadingPanel ID="radLoadingPanel" runat="server" />
            <telerik:RadAjaxPanel ID="ajaxPanel1" runat="server" >
                <telerik:RadComboBox ID="cbAjax" runat="server" Width="300px"></telerik:RadComboBox>
            </telerik:RadAjaxPanel>
          </div>
        </form>
    </body>
    </html>


    ASPX.CS File
    public class Foo
    {
        public string Text {get; set;}
        public string Value {get; set;}
      
        public Foo(string text, string value)
        {
            Text = text;
            Value = value;
        }
      
        public static Foo[] GetData()
        {
            return new Foo[] { 
                new Foo("Bar 1", "V1"), 
                new Foo("Bar 2", "V2"), 
                new Foo("Bar 3", "V3"), 
                new Foo("Bar 4", "V4")};
              
        }
    }
      
    public partial class Default2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindCB(cbPageLoad);
            }
        }
      
      
        protected void BindCB(RadComboBox cb)
        {
            cb.DataTextField = "Text";
            cb.DataValueField = "Value";
            cb.DataSource = Foo.GetData();
            cb.DataBind();
        }
      
        protected void btnShow_Click(object sender, EventArgs e)
        {
            BindCB(cbAjax);
        }
      
    }

  2. Helen
    Admin
    Helen avatar
    1052 posts

    Posted 17 Feb 2011 Link to this post

    Hello Nick,

    We don't recommend using the RadAjaxManager and RadAjaxPanel together. See for details the following help article:
    http://www.telerik.com/help/aspnet-ajax/ajxcontrolsinajaxpanelandajaxsettings.html

    Please replace the RadAjaxPanel with a regular ASP.Panel.

    Regards,
    Helen
    the Telerik team
Back to Top