using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        TreeView1.CollapseAll();  //折叠树的所有节点
    }
    protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
    {
        if (TreeView1 .SelectedNode .Value  == "绿叶")   //如果选择节点的Text值为绿叶，则pictureBox控件自动加载01.jpg图像
        {
            Image1.ImageUrl = "01.jpg";
        }
        if (TreeView1.SelectedNode.Value == "红花")
        {
            Image1.ImageUrl = "02.jpg";
        }
        if (TreeView1.SelectedNode.Value == "春节快乐")
        {
            Image1.ImageUrl = "03.gif";
        }
        if (TreeView1.SelectedNode.Value  == "舞狮")
        {
            Image1.ImageUrl = "04.gif";
        }
        if (TreeView1.SelectedNode.Value == "圣诞老人")
        {
            Image1.ImageUrl = "05.gif";
        }
        if (TreeView1.SelectedNode.Value == "卡通人物")
        {
            Image1.ImageUrl = "06.gif";
        }
        //如果选择节点的Text值为跳舞的女孩，则pictureBox控件自动加载07.gif动画
        if (TreeView1.SelectedNode.Value == "跳舞的女孩")
        {
            Image1.ImageUrl = "07.gif";
        }
        TreeView1.ExpandAll();          //展开树的所有节点
    }
}
