需要使用此事件處理程序傳遞參數,是否可以使用事件處理程序發送參數?請檢查我的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);
}
}
如果有任何疑問,請向任何類型暗示將提前
有什麼問題? – TalentTuner 2013-03-18 08:30:25