/// summary>
/// 初始化功能树结构
/// /summary>
private void InitFunction()
{
XmlDocument xmldoc = new XmlDocument();
string xmlPath = "~/adminFunction.xml";
xmlPath = Server.MapPath(xmlPath);
xmldoc.Load(xmlPath);
XmlNode root = xmldoc.DocumentElement;
foreach (XmlNode node in root.ChildNodes)
{
//获取父节点的信息显示(轻狂-书生)
XmlElement x1 = node as XmlElement;
string name = x1.GetAttribute("name");
string url = x1.GetAttribute("url");
TreeNode tn = new TreeNode();
tn.Text = name;
tn.NavigateUrl = url;
foreach (XmlNode subnode in x1.ChildNodes)
{
XmlElement subxmlEmt = subnode as XmlElement;
string subname = subxmlEmt.GetAttribute("name");
string suburl = subxmlEmt.GetAttribute("url");
TreeNode subtn = new TreeNode();
subtn.Text = subname;
subtn.NavigateUrl = suburl;
tn.ChildNodes.Add(subtn);
}
tvFunction.Nodes.Add(tn);
}
}