C#中treeview绑定xml
时间:2011-04-09 来源:xnfriday
<?xml version="1.0" encoding="UTF-8" ?> - <root StatusCode="Success" selgroup="1"> - <grouplevel1> <g00>1</g00> <g01>2</g01> <g02>3</g02> <g03>DS100测试</g03> <g04>DS100-1</g04> <g05>DS100-2</g05> <g06>DS100-3</g06> <g07>DS100-4</g07> </grouplevel1> - <grouplevel2> <g0000>11</g0000> <g0001>12</g0001> <g0002>13</g0002> </grouplevel2> - <grouplevel3> <g000100>111</g000100> <g000101>112</g000101> <g000102>113</g000102> <g000103>114</g000103> <g000104>115</g000104> </grouplevel3> </root>
变成
-1 -11 -111 -112 -113 -114 -115 -12 -2 -3使用代码
DataTable dt = new DataTable(); dt.ReadXml(你XML文件路径); this.TreeView1.DataSource = dt; this.TreeView1.DataBind();
相关阅读 更多 +