?xml version="1.0" encoding="gb2312"?>
<?xml-stylesheet type="text/xsl" href="TreeConfig/deepTree.xsl"?>
<TreeNode Title="产品展示">
<TreeNode Title="1.聚合物锂离子电池" >
<TreeNode Title="A.手机系列电芯"  NodeId="1" Target="contentFrm" Href="content.htm"/>
<TreeNode Title="B.蓝牙系列电芯"  NodeId="3" Target="contentFrm" Href="content.htm"/>
<TreeNode Title="C.PDA系列电芯 "  NodeId="5" Target="contentFrm" Href="content.htm"/>
    <TreeNode Title="D.DVD/笔记本系列电芯"  NodeId="1" Target="contentFrm" Href="content.htm"/>
<TreeNode Title="E.摄象机/数码相机系列电芯"  NodeId="3" Target="contentFrm" Href="content.htm"/>
<TreeNode Title="F.小灵通电池"  NodeId="5" Target="contentFrm" Href="content.htm"/>
    <TreeNode Title="G.对讲机"  NodeId="5" Target="contentFrm" Href="content.htm"/>
    <TreeNode Title="H.异形电芯电芯"  NodeId="1" Target="contentFrm" Href="content.htm"/>
<TreeNode Title="I.高倍率电芯"  NodeId="3" Target="contentFrm" Href="content.htm"/>
<TreeNode Title="J.军用通讯设备"  NodeId="5" Target="contentFrm" Href="content.htm"/>
<TreeNode Title="K.电池块"  NodeId="3" Target="contentFrm" Href="content.htm"/>
</TreeNode>
<TreeNode Title="2.锂离子电池 " >
<TreeNode Title="A.方形铝壳锂离子"  NodeId="1" Target="contentFrm" Href="content.htm"/>
<TreeNode Title="B.圆柱形锂离子"  NodeId="1" Target="contentFrm" Href="content.htm"/>
</TreeNode>
<TreeNode Title="3.镍氢电池" >
<TreeNode Title="A.普通型"  NodeId="1" Target="contentFrm" Href="content.htm"/>
<TreeNode Title="B.高倍率型"  NodeId="1" Target="contentFrm" Href="content.htm"/>
</TreeNode>
<TreeNode Title="4.航模电池及配件" >
<TreeNode Title="A.航模电池(持续10C放电)"  NodeId="1" Target="contentFrm" Href="content.htm"/>
<TreeNode Title="B.配件"  NodeId="1" Target="contentFrm" Href="content.htm"/>
</TreeNode>
<TreeNode Title="5.民用电池" >
<TreeNode Title="A.航模电池(持续10C放电)"  NodeId="1" Target="contentFrm" Href="content.htm"/>
<TreeNode Title="B.充电电池"  NodeId="1" Target="contentFrm" Href="content.htm"/>
<TreeNode Title="C.碳性电池"  NodeId="1" Target="contentFrm" Href="content.htm"/>
<TreeNode Title="D.扣式锂电池"  NodeId="1" Target="contentFrm" Href="content.htm"/>
<TreeNode Title="E.充电器"  NodeId="1" Target="contentFrm" Href="content.htm"/>
</TreeNode>
<TreeNode Title="6.汽车电池/电动车电池" >
<TreeNode Title="A.汽车电池"  NodeId="1" Target="contentFrm" Href="content.htm"/>
<TreeNode Title="B.电动车电池"  NodeId="1" Target="contentFrm" Href="content.htm"/>
</TreeNode>
<TreeNode Title="7.燃料电池/太阳能电池" >
<TreeNode Title="A.燃料电池"  NodeId="1" Target="contentFrm" Href="content.htm"/>
<TreeNode Title="B.太阳能电池"  NodeId="1" Target="contentFrm" Href="content.htm"/>
</TreeNode>

</TreeNode>

解决方案 »

  1.   

    http://search.csdn.net/Expert/topic/1825/1825086.xml?temp=.4372675
      

  2.   

    :向目标XML文件添加新节点<%@import namespace='system.xml'%>
    <%
    dim userdom1=new xmldocument,userdom2,userdom3
    userdom1.load (server.mappath("user.xml"))          '装载需要操作的XML文件
    userdom2=userdom1.selectsinglenode("alluser")       '操作游标指向alluser节点,句柄给userdom2变量
    userdom3=userdom1.createElement("fyw")              '新创建一名为fyw的节点,并将句柄给userdom3变量
    userdom3.setAttribute("name","风云舞")              '为userdom3添加节点属性,新属性名为name,值为风云舞
    userdom3.setAttribute("pass","123")
    userdom3.innerText="测试"                           '设置userdom3节点所包含的数据
    userdom2.AppendChild(userdom3)                      'userdom2即alluser节点下添加userdom3所描述的fyw节点
    userdom1.save (server.mappath("user.xml"))          '将变动后的新XML数据保存到user.xml
    %>5:修改XML节点<%@import namespace='system.xml'%>
    <%
    dim userdom1=new xmldocument,userdom2
    userdom1.load (server.mappath("user.xml"))
    userdom2=userdom1.selectsinglenode("alluser").getElementsBytagname("fyw")  '操作游标指向alluser节点下的fyw节点
    userdom2(0).setAttribute("name","风云舞")           '设定fyw节点数组的第一个,将其name属性值修改为风云舞
    userdom2(0).innerText="测试"                        '设定fyw节点数组的第一个,将其所包含的数据改为测试
    userdom1.save (server.mappath("user.xml"))          '将变动后的新XML数据保存到user.xml
    %>6:查找判断XML节点是否存在<%@import namespace='system.xml'%>
    <%
    dim userdom1=new xmldocument
    userdom1.load (server.mappath("user.xml"))          '装载需要操作的XML文件
    '以下正是本人为什么要用“用户帐号”标识用户唯一身份的目的,查找方便呀:)
    if userdom1.selectsinglenode("alluser").getElementsBytagname("fyw").count<>0 then t2("fyw节点以存在")
    %>7:批量添加XML节点(在编写回复帖子时,用第4例提到的方法一个一个填加节点很麻烦,这时可以考虑用此方法批量填加)<%@import namespace='system.xml'%>
    <%
    dim filedom=new xmldocument,filedom2
    filedom.load(server.mappath("data\" & request.querystring("dex")))  'request.querystring("dex")=6.xml
    filedom2=filedom.createElement("reply")
    '以下这种方法很方便,而且对XML文件的结构排版也很好,合理的空格和回车可以表现良好的XML文档结构
    filedom2.innerXml=vbcrlf & "      <anthor>" & session("who") & "</anthor>" & vbcrlf & "      <date>" & now & "</date>" & vbcrlf & "      <gengxindate>" & now & "</gengxindate>" & vbcrlf & "      <body>" & neirong.value & "</body>" & vbcrlf & "      "
    filedom.selectsinglenode("document/record").appendChild(filedom2)
    filedom.save(server.mappath("data\" & request.querystring("dex")))  'request.querystring("dex")=6.xml
    %>8:删除XML节点<%@import namespace='system.xml'%>
    <%
    dim userdom1=new xmldocument,userdom2
    userdom1.load (server.mappath("user.xml"))
    userdom1.DocumentElement.RemoveChild (userdom1.selectsinglenode("alluser/fyw"))  '删除alluser节点下的所有fyw节点
    userdom1.save (server.mappath("user.xml"))
    %>9:创建新的XML文件(可以创建任何类型后缀的文件,不局于XML文件)<%@import namespace='system.io'%>
    <%
    dim newfile=new StreamWriter(server.mappath("data\" & new DirectoryInfo(server.mappath("data")).getfiles().length+1 & ".xml"),false,System.Text.Encoding.Default)
    '以上我们指定默认编码方式为System.Text.encoding.default,或者可改为System.Text.encoding.GetEncoding("gb2312"),不然将以UTF8编码那样XML含有中文就无法正常工作了
    newfile.write ("<?xml version=" & chr(34) & "1.0" & chr(34) & " encoding=" & chr(34) & "gb2312" & chr(34) & "?>" & _
    vbcrlf & "<?xml-stylesheet type='text/xsl' href='../file.aspx?dex=" & filelength+1 & ".xml'?>" & vbcrlf & _
    "<document>" & vbcrlf & "   <record>" & vbcrlf & "   <anthor>" & session("who") & "</anthor>" & vbcrlf & _
    "   <title>" & server.HTMLEncode(biaoti.value) & "</title>" & vbcrlf & "   <date>" & now & "</date>" & vbcrlf & _
    "   <gengxindate>" & now & "</gengxindate>" & vbcrlf & "   <body>" & server.HTMLEncode(neirong.text) & "</body>" & vbcrlf & _
    "   </record>" & vbcrlf & "</document>")
    newfile.close:newfile=nothing
    %>10:删除指定文件<%@import namespace='system.io'%>
    <%file.delete(server.mappath("data\2.xml"))%>
      

  3.   

    http://search.csdn.net/Expert/topic/2579/2579717.xml?temp=.9995996
      

  4.   

    你说的跟我以前写过的一个xml文件几乎一模一样
    把我的代码给你吧
    menu.xml文件:
    <?xml version="1.0" encoding="gb2312"?>
    <MainMenu>
      <Menu name="主页" href="index.aspx" tooltip="返回主页" visibility="true" />
      <Menu name="风云书库" href="#" tooltip="风云书库" visibility="true">
        <Menu name="魔法玄幻" href="moretopic.aspx?class_id=1" tooltip="" visibility="true" />
        <Menu name="武侠小说" href="moretopic.aspx?class_id=2" tooltip="" visibility="true" />
      </Menu>
      <Menu name="成员列表" href="#" tooltip="" visibility="true">
        <Menu name="普通会员" href="#" tooltip="" visibility="true" />
        <Menu name="专栏作家" href="#" tooltip="" visibility="true" />
        <Menu name="斑竹信息" href="#" tooltip="" visibility="true" />
        <Menu name="所有成员" href="#" tooltip="" visibility="true" />
      </Menu>
      <Menu name="用户功能" href="#" tooltip="" visibility="False">
        <Menu name="我的书架" href="mybookshelf.aspx" tooltip="" visibility="False" />
        <Menu name="用户信息" href="register.aspx?act=MODIFY" tooltip="" visibility="False" />
      </Menu>
      <Menu name="登陆选项" href="#" tooltip="" visibility="true">
        <Menu name="用户登陆" href="index.aspx" tooltip="" visibility="True" />
        <Menu name="用户注册" href="register.aspx" tooltip="" visibility="True" />
        <Menu name="取回密码" href="#" tooltip="" visibility="true" />
      </Menu>
      <Menu name="友情链接" href="#" tooltip="" visibility="true">
        <Menu name="幻剑书盟" href="http://www.hjsm.net/" tooltip="http://www.hjsm.net/" visibility="true" />
      </Menu>
      <Menu name="系统维护" href="./sysmaintenance/Default.aspx" tooltip="系统维护" visibility="True" />
      <Menu name="简体版" href="index.aspx" tooltip="" visibility="true" />
      <Menu name="繁体版" href="" tooltip="" visibility="true" />
    </MainMenu>
    维护页面(MenuConfig.aspx)
    <%@ Page language="c#" Codebehind="MenuConfig.aspx.cs" AutoEventWireup="false" Inherits="myNovelSite.MenuConfig.MenuConfig" %>
    <%@ OutputCache Duration="1" VaryByParam="None" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <HTML>
    <HEAD>
    <title>MenuConfig</title>
    <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
    <meta content="C#" name="CODE_LANGUAGE">
    <meta content="JavaScript" name="vs_defaultClientScript">
    <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    <LINK href="../css/STYLE.CSS" type="text/css" rel="stylesheet">
    </HEAD>
    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
    <div align="center">主页菜单管理
    <table cellPadding="4" width="630" border="1">
    <tr>
    <td>
    <table id="table1" width="100%" border="0" runat="server">
    <tr>
    <td>一级菜单</td>
    <td><asp:dropdownlist id="DropDownList1" runat="server" Width="148"></asp:dropdownlist></td>
    <td>菜单项名称</td>
    <td><asp:textbox id="TextBox1" runat="server" Enabled="False"></asp:textbox><asp:button id="Button1" runat="server" Height="22px" ForeColor="Black" CssClass="btncss" Text="修改"></asp:button><asp:button id="Button8" runat="server" Height="22px" ForeColor="Black" CssClass="btncss" Text="添加"></asp:button><asp:button id="Button9" runat="server" Height="22px" ForeColor="Black" CssClass="btncss" Text="删除"></asp:button><asp:button id="Button10" runat="server" Height="22px" ForeColor="Black" CssClass="btncss" Text="插入"></asp:button></td>
    </tr>
    <tr>
    <td>二级菜单</td>
    <td><asp:dropdownlist id="DropDownList2" runat="server" Width="148px"></asp:dropdownlist></td>
    <td>菜单项名称</td>
    <td><asp:textbox id="TextBox2" runat="server" Enabled="False"></asp:textbox><asp:button id="Button2" runat="server" Height="22px" ForeColor="Black" CssClass="btncss" Text="修改"></asp:button><asp:button id="Button13" runat="server" Height="22px" ForeColor="Black" CssClass="btncss" Text="添加"></asp:button><asp:button id="Button12" runat="server" Height="22px" ForeColor="Black" CssClass="btncss" Text="删除"></asp:button><asp:button id="Button11" runat="server" Height="22px" ForeColor="Black" CssClass="btncss" Text="插入"></asp:button></td>
    </tr>
    </table>
    <asp:Button id="Button14" runat="server" Width="351px" Height="22px" ForeColor="Black" CssClass="btncss"
    Text="动态在当前二级菜单下插入[类别]菜单"></asp:Button>
    <asp:button id="Button15" runat="server" Text="添加属性" CssClass="btncss" ForeColor="Black" Height="22px"></asp:button></td>
    </tr>
    <tr>
    <td>
    <table width="100%" border="0">
    <tr>
    <td colSpan="2">一级菜单</td>
    </tr>
    <tr>
    <td align="left" colSpan="2">
    <hr width="90%">
    </td>
    </tr>
    <tr>
    <td width="120">名称(name):</td>
    <td width="484"><asp:textbox id="TextBox3" runat="server" Width="434" Enabled="False"></asp:textbox></td>
    </tr>
    <tr>
    <td>链接(href):</td>
    <td><asp:textbox id="TextBox4" runat="server" Width="434px" Enabled="False"></asp:textbox></td>
    </tr>
    <tr>
    <td>提示(tooltip):</td>
    <td><asp:textbox id="TextBox5" runat="server" Width="434px" Enabled="False"></asp:textbox></td>
    </tr>
    <tr>
    <td>是否可见(visibility):</td>
    <td>
    <asp:CheckBox id="CheckBox1" runat="server"></asp:CheckBox></td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td>
    <table width="100%" border="0">
    <tr>
    <td colSpan="2">二级菜单</td>
    </tr>
    <tr>
    <td align="left" colSpan="2">
    <hr width="90%">
    </td>
    </tr>
    <tr>
    <td width="120">名称(name):</td>
    <td width="484"><asp:textbox id="TextBox6" runat="server" Width="434" Enabled="False"></asp:textbox></td>
    </tr>
    <tr>
    <td>链接(href):</td>
    <td><asp:textbox id="TextBox7" runat="server" Width="434px" Enabled="False"></asp:textbox></td>
    </tr>
    <tr>
    <td>提示(tooltip):</td>
    <td><asp:textbox id="TextBox8" runat="server" Width="434px" Enabled="False"></asp:textbox></td>
    </tr>
    <tr>
    <td>是否可见(visibility):</td>
    <td>
    <asp:CheckBox id="CheckBox2" runat="server"></asp:CheckBox></td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td>
    <table width="100%" border="0">
    <tr>
    <td align="center"><asp:button id="Button7" runat="server" Enabled="False" Height="25" CssClass="btncss" Text="提交插入"></asp:button><asp:button id="Button6" runat="server" Enabled="False" Height="25" CssClass="btncss" Text="提交添加"></asp:button><asp:button id="Button3" runat="server" Enabled="False" Height="25" CssClass="btncss" Text="提交修改"></asp:button><asp:button id="Button4" runat="server" Enabled="False" Height="25px" CssClass="btncss" Text="取消"></asp:button><asp:button id="Button5" runat="server" Height="25px" CssClass="btncss" Text="关闭"></asp:button></td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </div>
    <asp:literal id="Literal1" runat="server"></asp:literal>
    <asp:Literal id="Literal2" runat="server"></asp:Literal><INPUT id="Hidden1" style="Z-INDEX: 100; LEFT: 168px; POSITION: absolute; TOP: 552px" type="hidden"
    name="Hidden1" runat="server"><INPUT id="Hidden2" style="Z-INDEX: 101; LEFT: 328px; POSITION: absolute; TOP: 552px" type="hidden"
    name="Hidden2" runat="server"><INPUT id="Hidden3" style="Z-INDEX: 103; LEFT: 480px; POSITION: absolute; TOP: 552px" type="hidden"
    name="Hidden3" runat="server"></form>
    </body>
    </HTML>
      

  5.   

    维护代码(MenuConfig.aspx.cs)
    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;
    using System.Xml;
    using System.Reflection;
    using System.Data.SqlClient;
    using System.Web.Security;
    using System.Configuration;
    using myNovelSite.check;
    namespace myNovelSite.MenuConfig
    {
    /// <summary>
    /// MenuConfig 的摘要说明。
    /// </summary>
    public class MenuConfig : System.Web.UI.Page
    {
    protected System.Web.UI.WebControls.DropDownList DropDownList1;
    protected System.Web.UI.WebControls.DropDownList DropDownList2;
    protected System.Web.UI.WebControls.TextBox TextBox1;
    protected System.Web.UI.WebControls.TextBox TextBox2;
    protected System.Web.UI.WebControls.Button Button1;
    protected System.Web.UI.WebControls.Button Button2;
    protected System.Web.UI.WebControls.TextBox TextBox3;
    protected System.Web.UI.WebControls.TextBox TextBox4;
    protected System.Web.UI.WebControls.TextBox TextBox5;
    protected System.Web.UI.WebControls.Button Button3;
    protected System.Web.UI.WebControls.Button Button4;
    protected System.Web.UI.WebControls.Button Button5;
    protected System.Web.UI.WebControls.Literal Literal1;
    protected System.Web.UI.WebControls.Button Button8;
    protected System.Web.UI.WebControls.Button Button9;
    protected System.Web.UI.WebControls.Button Button10;
    protected System.Web.UI.WebControls.Button Button11;
    protected System.Web.UI.WebControls.Button Button12;
    protected System.Web.UI.WebControls.Button Button13;
    protected System.Web.UI.HtmlControls.HtmlTable table1;
    protected System.Web.UI.WebControls.TextBox TextBox6;
    protected System.Web.UI.WebControls.TextBox TextBox7;
    protected System.Web.UI.WebControls.TextBox TextBox8;
    protected System.Web.UI.WebControls.Button Button6;
    protected System.Web.UI.WebControls.Literal Literal2;
    protected System.Web.UI.WebControls.Button Button7;
    protected System.Web.UI.WebControls.Button Button14;
    protected System.Web.UI.HtmlControls.HtmlInputHidden Hidden1;
    protected System.Web.UI.WebControls.CheckBox CheckBox1;
    protected System.Web.UI.WebControls.CheckBox CheckBox2;
    protected System.Web.UI.WebControls.Button Button15;
    protected System.Web.UI.HtmlControls.HtmlInputHidden Hidden2;
    protected System.Web.UI.HtmlControls.HtmlInputHidden Hidden3;
    #region 变量声明
    static XmlDocument xmldoc=new XmlDocument();
    string[] attributeName=new string[]{"@name","@href","@tooltip","@visibility"};
    private string pw=ConfigurationSettings.AppSettings["pw"];
    static string xmlpath=null;
    #endregion
    enum operateWay
    {
    alert,
    add,
    insert,
    all
    }

    private void Page_Load(object sender, System.EventArgs e)
    {
    // 在此处放置用户代码以初始化页面
    checkManager cm=new checkManager(this.Session["loginuser"],this.Session["userlevel"]);
    if(!cm.checklogin())
    {
    Response.Write("<script>alert('您还没有登陆,请先登陆!')</script>");
    Response.End();
    return;
    }
    if(!cm.checkLevel())
    {
    Response.Write("<script>alert('您的权限不够,不能操作本页面!')</script>");
    Response.End();
    return;
    }
    if(!IsPostBack)
    {
    xmlpath =Server.MapPath("./menu.xml");
    xmldoc.Load(xmlpath);
    initData();
    this.DropDownList1.AutoPostBack=true;
    this.DropDownList2.AutoPostBack=true;
    this.Button5.Attributes.Add("onclick","javascript:window.close();return false" );
    this.Button9.Attributes.Add("onclick","javascript:return confirm('确认删除该数据吗?');");
    this.Button12.Attributes.Add("onclick","javascript:return confirm('确认删除该数据吗?');");
    this.Button14.Attributes.Add("onclick","javascript:document.all.Hidden3.value=prompt('请输入管理员密码:');");
    string jsstr="javascript:document.all.Hidden1.value=prompt('请输入属性名称:','');"+
    "document.all.Hidden2.value=prompt('请输入默认值:','');"+
    "document.all.Hidden3.value=prompt('请输入管理员密码:');"+
    "return confirm('您输入的属性名称为'+document.all.Hidden1.value+'\\n默认值为'+document.all.Hidden2.value+'\\n确认添加吗?');";
    this.Button15.Attributes.Add("onclick",jsstr);
    }
    this.DropDownList1.SelectedIndexChanged+=new EventHandler(DropDownList1_SelectedIndexChanged);
    this.DropDownList2.SelectedIndexChanged+=new EventHandler(DropDownList2_SelectedIndexChanged);

    this.Button1.Click +=new EventHandler(AlterCurNode_Click);
    this.Button2.Click +=new EventHandler(AlterCurNode_Click);
    this.Button8.Click +=new EventHandler(AddNode_Click);
    this.Button13.Click +=new EventHandler(AddNode_Click);
    this.Button9.Click +=new EventHandler(DelNode_Click);
    this.Button12.Click +=new EventHandler(DelNode_Click);
    this.Button10.Click +=new EventHandler(InsertNode_Click);
    this.Button11.Click +=new EventHandler(InsertNode_Click);

    this.Literal1.Text ="";
    this.Literal2.Text ="";
    }
      

  6.   

    private void initData()
    {
    this.DropDownList1.Items.Clear();
    XmlNodeList nl= xmldoc.SelectNodes("/MainMenu/Menu");
    for(int i=0;i<nl.Count;i++)
    {
    XmlNode xn= nl[i];
    this.DropDownList1.Items.Add(xn.SelectSingleNode("@name").Value);
    }
    this.DropDownList1.SelectedIndex=0;
    this.DropDownList1_SelectedIndexChanged(this.DropDownList1,null);
    }
    #region Web 窗体设计器生成的代码
    override protected void OnInit(EventArgs e)
    {
    //
    // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
    //
    InitializeComponent();
    base.OnInit(e);
    }

    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {    
    this.Button14.Click += new System.EventHandler(this.Button14_Click);
    this.Button15.Click += new System.EventHandler(this.Button15_Click);
    this.Button7.Click += new System.EventHandler(this.Button7_Click);
    this.Button6.Click += new System.EventHandler(this.Button6_Click);
    this.Button3.Click += new System.EventHandler(this.Button3_Click);
    this.Button4.Click += new System.EventHandler(this.Button4_Click);
    this.Load += new System.EventHandler(this.Page_Load); }
    #endregion private void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
    this.Button4_Click(this.Button4,null);
    this.DropDownList2.Items.Clear();
    string name=this.DropDownList1.SelectedValue.Trim();
    this.TextBox1.Text =name;
    int[] ButtonID=new int[]{1,9,10,2,11,12,13};
    if(name!="")
    {
    XmlNode xn=LoadNodeData(1);
    foreach(int i in ButtonID)
    setControlEnabledStatus(this.Page.FindControl("Button"+i.ToString()),true);
    for(int i=0;i<xn.ChildNodes.Count;i++)
    {
    XmlNode xn1=xn.ChildNodes[i];
    this.DropDownList2.Items.Add(xn1.SelectSingleNode("@name").Value);
    }
    this.DropDownList2.SelectedIndex=0;
    this.DropDownList2_SelectedIndexChanged(this.DropDownList2,null);
    }
    else
    {
    foreach(int i in ButtonID)
    setControlEnabledStatus(this.Page.FindControl("Button"+i.ToString()),false);
    }
    } private XmlNode LoadNodeData(int CurRow)
    {
    int[] TextID=null;
    int j=0;
    string xPath=null;
    getTextIDAndxPath(CurRow,ref TextID,ref xPath);
    XmlNode xn=xmldoc.SelectSingleNode(xPath);
    foreach(int i in TextID)
    {
    setControlValue(this.Page.FindControl("TextBox"+i.ToString()),xn.SelectSingleNode(attributeName[j++]).Value);
    }
    setControlValue(this.Page.FindControl("CheckBox"+CurRow.ToString()),xn.SelectSingleNode(attributeName[j++]).Value);
    return xn;
    }
    private void getTextIDAndxPath(int CurRow,ref int[] TextID,ref string xPath)
    {
    if(CurRow==1)
    {
    TextID=new int[]{3,4,5};
    string name=getControlValue(this.table1.Rows[CurRow-1].Cells[1].Controls[0]);
    xPath ="/MainMenu/Menu[@name='"+name+"']";
    }
    else if(CurRow ==2)
    {
    TextID=new int[]{6,7,8};
    string name=getControlValue(this.table1.Rows[CurRow-2].Cells[1].Controls[0]);
    string name1=getControlValue(this.table1.Rows[CurRow-1].Cells[1].Controls[0]);
    xPath ="/MainMenu/Menu[@name='"+name+"']/Menu[@name='"+name1+"']";
    }
    else
    {
    TextID =null;
    xPath =null;
    }
    }
    private void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
    {
    this.Button4_Click(this.Button4,null);
    string name=this.DropDownList1.SelectedValue;
    string name1=this.DropDownList2.SelectedValue;
    this.TextBox2.Text =name1;
    int[] ButtonID=new int[]{2,11,12};
    int[] TextID=new int[]{6,7,8};
    if(name1 !="")
    {
    LoadNodeData(2);
    foreach(int i in ButtonID)
    setControlEnabledStatus(this.Page.FindControl("Button"+i.ToString()),true);
    }
    else
    {
    foreach(int i in ButtonID)
    setControlEnabledStatus(this.Page.FindControl("Button"+i.ToString()),false);
    foreach(int i in TextID)
    setControlValue(this.Page.FindControl("TextBox"+i.ToString()),"");
    }
    } private void AlterCurNode_Click(object sender, EventArgs e) //修改事件
    {
    this.Button4_Click(this.Button4,null);
    Button bn=(Button)sender;
    HtmlTableRow tr=(HtmlTableRow)bn.Parent.Parent;
    int CurRow;
    if(this.ViewState["CurRow"]==null)
    {
    CurRow=getCurRow(getControlValue(tr.Cells[0].Controls[0]));
    this.ViewState.Add("CurRow",CurRow);
    }
    else
    CurRow =Convert.ToInt32(this.ViewState["CurRow"].ToString());
    if(CurRow!=-1)
    {
    setControlCollectionsEnabledStatus(CurRow,true,operateWay.alert);
    setControlGetFocus(CurRow==1?this.TextBox3:this.TextBox6);
    }
    this.ViewState.Add("alertName",CurRow==1?this.TextBox3.Text:this.TextBox6.Text);
    }
    private void AddNode_Click(object sender, EventArgs e) //添加事件
    {
    this.Button4_Click(this.Button4,null);
    Button bn=(Button)sender;
    HtmlTableRow tr=(HtmlTableRow)bn.Parent.Parent;
    int CurRow;
    if(this.ViewState["CurRow"]==null)
    {
    CurRow=getCurRow(getControlValue(tr.Cells[0].Controls[0]));
    this.ViewState.Add("CurRow",CurRow);
    }
    else
    CurRow =Convert.ToInt32(this.ViewState["CurRow"].ToString());
    if(CurRow!=-1)
    {
    setControlCollectionsEnabledStatus(CurRow,true,operateWay.add);
    setControlGetFocus(CurRow==1?this.TextBox3:this.TextBox6);
    int[] TextID=null;
    string xPath=null;
    getTextIDAndxPath(CurRow,ref TextID,ref xPath);
    if(TextID!=null)
    {
    foreach(int i in TextID)
    {
    setControlValue(this.Page.FindControl("TextBox"+i.ToString()),"");
    }
    }
    }
    }
    private void InsertNode_Click(object sender, EventArgs e) //插入事件
    {
    this.Button4_Click(this.Button4,null);
    Button bn=(Button)sender;
    HtmlTableRow tr=(HtmlTableRow)bn.Parent.Parent;
    int CurRow;
    if(this.ViewState["CurRow"]==null)
    {
    CurRow=getCurRow(getControlValue(tr.Cells[0].Controls[0]));
    this.ViewState.Add("CurRow",CurRow);
    }
    else
    CurRow =Convert.ToInt32(this.ViewState["CurRow"].ToString());
    if(CurRow!=-1)
    {
    setControlCollectionsEnabledStatus(CurRow,true,operateWay.insert);
    setControlGetFocus(CurRow==1?this.TextBox3:this.TextBox6);
    int[] TextID=null;
    string xPath=null;
    getTextIDAndxPath(CurRow,ref TextID,ref xPath);
    if(TextID!=null)
    {
    foreach(int i in TextID)
    {
    setControlValue(this.Page.FindControl("TextBox"+i.ToString()),"");
    }
    }
    }
    }
    private int getCurRow(string str)
    {
    int ret=-1;
    if(str.StartsWith("一"))
    ret =1;
    else if(str.StartsWith("二"))
    ret =2;
    else
    ret =-1;
    return ret;
    }