Completed
Last Updated: 04 Apr 2012 03:53 by ADMIN
ADMIN
Stefan
Created on: 04 Apr 2012 03:53
Category: TreeView
Type: Bug Report
3
FIX. RadTreeView - SelectedNode and SelectedNodes should be cleared when the DataSource of the control is set to null
FIX. RadTreeView - SelectedNode and SelectedNodes should be cleared when the DataSource of the control is set to null
test app:
using System;
using System.Data;
using System.Windows.Forms;
using Telerik.WinControls.UI;
namespace Lab.Tree
{
public partial class TreeResetSelectionAfterDataSourceIsSetToNull : MainForm
{
private RadTreeView treeView = new RadTreeView();
public TreeResetSelectionAfterDataSourceIsSetToNull()
{
InitializeComponent();
treeView.Dock = DockStyle.Fill;
treeView.Parent = this;
treeView.BringToFront();
DataTable table = new DataTable();
table.Columns.Add("Id");
table.Columns.Add("Name");
table.Rows.Add("1", "name1");
table.Rows.Add("2", "name2");
table.Rows.Add("3", "name3");
treeView.DisplayMember = "Name";
treeView.DataSource = table;
treeView.MultiSelect = true;
}
protected override void OnButton1Click()
{
Console.WriteLine(treeView.SelectedNodes.Count);
Console.WriteLine(treeView.SelectedNode);
treeView.DataSource = null;
Console.WriteLine("-------------------------------------------");
Console.WriteLine(treeView.SelectedNodes.Count);
Console.WriteLine(treeView.SelectedNode);
}
}
}
0 comments