Left.aspx.cs
资源名称:SunShine.rar [点击查看]
上传用户:tjxpgg
上传日期:2017-05-14
资源大小:2244k
文件大小:1k
源码类别:
SilverLight
开发平台:
ASP/ASPX
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using System.Xml;
- public partial class Left : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- Tree();
- }
- }
- public void Tree()
- {
- XmlDataDocument x = new XmlDataDocument();
- x.Load(Server.MapPath( "ZhanDianDaoHang.xml"));
- XmlElement xe = x.DocumentElement;
- TreeNode tn = new TreeNode();
- tn.Text = xe.Attributes["title"].Value;
- this.TreeView1.Nodes.Add(tn);
- foreach (XmlNode xn in xe.ChildNodes)
- {
- TreeNode tnn = new TreeNode();
- tnn.Text = xn.Attributes["title"].Value;
- this.TreeView1.Nodes.Add(tnn);
- foreach (XmlNode xmlnode in xn.ChildNodes)
- {
- TreeNode treenode = new TreeNode();
- treenode.Text = xmlnode.Attributes["title"].Value;
- treenode.NavigateUrl = xmlnode.Attributes["url"].Value;
- treenode.Target = "main";
- tnn.ChildNodes.Add(treenode);
- }
- }
- }
- }