Completed
Last Updated: 07 Jun 2011 04:40 by Svetlin
Svetlin
Created on: 07 Jun 2011 04:40
Category: TreeView
Type: Bug Report
0
FIX Add new node and remove node via context menu in self-reference hierarchy
When you add a new node in self-referencing hierarchy, several nodes are added on random levels. In addition, if you remove an existing node, a NullReferenceException is thrown.
test project:
using System.Data;
using System.Windows.Forms;
using Telerik.WinControls.UI;
namespace Lab.Tree
{
public partial class TreeSelfReferenceAddFrom : Form
{
private RadTreeView treeView = new RadTreeView();
public TreeSelfReferenceAddFrom()
{
InitializeComponent();
treeView.Dock = DockStyle.Fill;
treeView.Parent = this;
treeView.AllowDefaultContextMenu = true;
treeView.AllowAdd = true;
treeView.AllowEdit = true;
treeView.AllowDrop = true;
treeView.AllowDragDrop = true;
treeView.AllowRemove = true;
DataTable table = new DataTable();
table.Columns.Add("ID");
table.Columns.Add("ParentID");
table.Columns.Add("Name");
table.Rows.Add(1, 0, "Name1");
table.Rows.Add(2, 0, "Name2");
table.Rows.Add(3, 0, "Name3");
table.Rows.Add(4, 1, "Name5");
table.Rows.Add(5, 1, "Name6");
table.Rows.Add(6, 3, "Name6");
treeView.DisplayMember = "Name";
treeView.ChildMember = "ID";
treeView.ParentMember = "ParentID";
treeView.DataSource = table;
}
}
}
0 comments