I believe I have identified a bug with the RadDropDownTree control when it is used on a page with the AjaxManager but is not one of the updated controls of an Ajax postback. I have noticed and captured where the RadDropDownTree only has one selected value, but when checking the RadDropDownTree's SelectedValue it often has the selected value listed multiples times after the Ajax postback. Below is the example code I put together and steps I am able to reproduce the issue.
STEPS:
If you were to add the RadDropDownTree as an updated control in AjaxManager, reload the page, and try the steps again the selected value works as expected having only the single selected value.
If you were to comment out the AjaxManager, reload the page, and try the steps again the Selected value operates as expected only having the single SelectedValue.
Bug or is there some setting I am missing? Thanks!
Kerry
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RadDropDownTreeTest.aspx.cs" Inherits="ALPS.Net.Development.RadDropDownTreeTest" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title></head><body> <form id="form1" runat="server"> <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadDropDownList1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadDropDownList2" /> <telerik:AjaxUpdatedControl ControlID="SelectedValue" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default"></telerik:RadAjaxLoadingPanel> <div> <telerik:RadDropDownList ID="RadDropDownList1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="RadDropDownList1_SelectedIndexChanged"> <Items> <telerik:DropDownListItem Value="alpha" Text="Alpha" Selected="true" /> <telerik:DropDownListItem Value="num" Text="Numeric" /> </Items> </telerik:RadDropDownList> </div> <div> <telerik:RadDropDownList ID="RadDropDownList2" runat="server"></telerik:RadDropDownList> </div> <div> <telerik:RadDropDownTree ID="RadDropDownTree1" runat="server" DataFieldParentID="ParentID" DataFieldID="ID" DataTextField="Text" DataValueField="Value"> </telerik:RadDropDownTree> </div> <div> <asp:Label ID="SelectedValue" runat="server" /> </div> </form></body></html>using System;using System.Collections.Generic;using System.Data;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using Telerik.Web.UI;namespace ALPS.Net.Development{ public partial class RadDropDownTreeTest : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { RadDropDownTree1.DataSource = GetData(); RadDropDownTree1.NodeDataBound += RadDropDownTree1_NodeDataBound; if (!IsPostBack) { BuildAlphaList(); RadDropDownTree1.DataBind(); } SelectedValue.Text = RadDropDownTree1.SelectedValue; } void RadDropDownTree1_NodeDataBound(object sender, Telerik.Web.UI.DropDownTreeNodeDataBoundEventArguments e) { if (e.DropDownTreeNode.Text == "Text2 ") e.DropDownTreeNode.CreateEntry(); } public DataTable GetData() { DataTable table = new DataTable(); table.Columns.Add("ID"); table.Columns.Add("ParentID"); table.Columns.Add("Value"); table.Columns.Add("Text"); table.Rows.Add(new String[] { "1", null, "customValue1", "Text1 " }); table.Rows.Add(new String[] { "2", "1", "customValue2", "Text2 " }); table.Rows.Add(new String[] { "3", "2", "customValue3", "Text3 " }); table.Rows.Add(new String[] { "4", "3", "customValue4", "Text4 " }); table.Rows.Add(new String[] { "5", "3", "customValue5", "Text5 " }); table.Rows.Add(new String[] { "6", "5", "customValue2", "Text6 " }); table.Rows.Add(new String[] { "7", "6", "customValue2", "Text7 " }); table.Rows.Add(new String[] { "8", "7", "customValue2", "Text8 " }); table.Rows.Add(new String[] { "9", "1", "customValue9", "Text9 " }); table.Rows.Add(new String[] { "10", "1", "customValue10", "Text10 " }); return table; } public void BuildAlphaList() { RadDropDownList2.Items.Clear(); RadDropDownList2.Items.Add(new DropDownListItem { Value="A", Text="A" }); RadDropDownList2.Items.Add(new DropDownListItem { Value = "B", Text = "B" }); RadDropDownList2.Items.Add(new DropDownListItem { Value = "C", Text = "C" }); } public void BuildNumList() { RadDropDownList2.Items.Clear(); RadDropDownList2.Items.Add(new DropDownListItem { Value = "1", Text = "1" }); RadDropDownList2.Items.Add(new DropDownListItem { Value = "2", Text = "2" }); RadDropDownList2.Items.Add(new DropDownListItem { Value = "3", Text = "3" }); } protected void RadDropDownList1_SelectedIndexChanged(object sender, DropDownListEventArgs e) { if (e.Value == "alpha") BuildAlphaList(); else BuildNumList(); } }}STEPS:
- Load the page.
- From the RadDropDownTree control select the top most node "Text1"
- From the first RadDropDownList select Numeric and notice the value of the label ("customValue1")
- From the first RadDropdownList select Alpha and again notice the value of the label ("customValue1,customValue1")
- From the first RadDropDownList select Numeric again and again view the label ("customValue1,customValue1,customValue1")
If you were to add the RadDropDownTree as an updated control in AjaxManager, reload the page, and try the steps again the selected value works as expected having only the single selected value.
If you were to comment out the AjaxManager, reload the page, and try the steps again the Selected value operates as expected only having the single SelectedValue.
Bug or is there some setting I am missing? Thanks!
Kerry
