/// <summary> /// 生成TreeNode /// </summary> /// <returns></returns> private TreeNode ToTreeNode() { //对象的初始化器直接构造 TreeNode treeNode = new TreeNode() { id = this.ID, text = this.Name, state = "open", Checked = false, attributes = new {isAticon = this.IsActive }, children = new List<TreeNode>() // 子节点集合 }; return treeNode; }
/// <summary> /// 生成TreeNode /// </summary> /// <returns></returns> private TreeNode ToTreeNode() { //对象的初始化器直接构造 TreeNode treeNode = new TreeNode() { id = this.ID.ToString(), text = this.Name, state = "open", iconCls= this.ICO, Checked = false, attributes = new { url = this.GetUrl(this.AreaName, this.ControllerName, this.ActionName)}, //把生成的URL存到 children = new List<TreeNode>() // 子节点集合 }; return treeNode; }