<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>将XML文件中数据绑定到TreeView控件</title>
    <style type="text/css">
        .style1
        {
            font-family: 微软雅黑;
            font-size: x-large;
            font-weight: bold;
        }
        .style2
        {
            color: #000080;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <table align="center" style="width: 497px;">
            <tr>
                <td align="center" class="style1" >
                    <span class="style2">将XML文件中数据绑定到TreeView控件</span><br />
                </td>
            </tr>
            <tr>
                <td   >
                    <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/XMLFile.xml">
                    </asp:XmlDataSource>
                    <asp:TreeView ID="TreeView1" runat="server" DataSourceID="XmlDataSource1" 
                        Height="164px" Width="207px">
                        <DataBindings>
                            <asp:TreeNodeBinding DataMember="NewDataSet" TextField="title" 
                                ValueField="title" />
                            <asp:TreeNodeBinding DataMember="tree" TextField="title" ValueField="title" />
                            <asp:TreeNodeBinding DataMember="Option" TextField="#InnerText" 
                                ValueField="#InnerText" />
                        </DataBindings>
                    </asp:TreeView>
                    <br />
                </td>
            </tr>
        </table>
    
    </div>
    </form>
</body>
</html>
