需要使用此事件处理程序传递参数,是否可以使用事件处理程序发送参数?请检查我的RadTreeView2_NodeExpand
语法。
internal void LoadTree(RadTreeView treeView, System.Collections.IEnumerable r)
{
LoadRootNodes(ref treeView, TreeNodeExpandMode.ServerSideCallBack, r);
treeView += RadTreeView2_NodeExpand(r);
}
public void RadTreeView2_NodeExpand(object sender, RadTreeNodeEventArgs e, System.Collections.IEnumerable r)
{
if (e.Node.Nodes.Count == 0)
PopulateNodeOnDemand(e, TreeNodeExpandMode.ServerSide, r);
}
private static void PopulateNodeOnDemand(RadTreeNodeEventArgs e, TreeNodeExpandMode expandMode, System.Collections.IEnumerable r)
{
//List<testTable> data = GetChildNodes(e.Node.Value);
foreach (testTable row in r)
{
RadTreeNode node = new RadTreeNode();
node.Text = row.Address;//row["Title"].ToString();
node.Value = row.ID; //row["CategoryId"].ToString();
//if (Convert.ToInt32(row["ChildrenCount"]) > 0)
//{
// node.ExpandMode = expandMode;
//}
e.Node.Nodes.Add(node);
}
e.Node.Expanded = true;
}
private static void LoadRootNodes(ref RadTreeView treeView, TreeNodeExpandMode expandMode, System.Collections.IEnumerable data)
{
//DataTable data = GetData(new SqlCommand("SELECT * FROM ProductCategories WHERE ParentId IS NULL"));
foreach (testTable row in data)
{
RadTreeNode node = new RadTreeNode();
node.Text = row.Address;//row["Title"].ToString();
node.Value = row.ID;//row["CategoryId"].ToString();
node.ExpandMode = expandMode;
treeView.Nodes.Add(node);
}
}
如果有任何问题,请询问,任何类型的建议都将被接受提前谢谢