protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
InitTreeByList(this.tvMenu.Nodes, "0");
}
}
private void InitTreeByList(TreeNodeCollection tnc, string parentId)
{
List<SysFun> list = SysFunService.GetSysFun();
foreach (SysFun sf in list)
{
if (sf.ParentNodeId == Convert.ToInt32(parentId))
{
TreeNode node = new TreeNode();
node.Value = sf.NodeId.ToString();
node.Text = sf.DisplayName;
node.NavigateUrl = sf.NodeURL;
tnc.Add(node);
InitTreeByList(node.ChildNodes, node.Value);
}
}
}