我通过 XmlDataSource 得到了简单的 TreeView 绑定。这些数据表示包含某些项目的类别。我需要显示这些类别中的记录数。我怎样才能做到这一点?我得到了这个代码:
<asp:TreeView ID="TreeView1"
runat="server"
DataSourceID="XmlDataSource1"
ImageSet="Arrows"
ExpandDepth="1"
OnSelectedNodeChanged="TreeView1_SelectedNodeChanged">
<DataBindings>
<asp:TreeNodeBinding DataMember="root" TextField="name" ValueField="id" />
<asp:TreeNodeBinding DataMember="category" TextField="name" ValueField="id" />
<asp:TreeNodeBinding DataMember="subcategory" TextField="name" ValueField="id" />
<asp:TreeNodeBinding DataMember="subsubcategory" TextField="name" ValueField="id" />
</DataBindings>
<HoverNodeStyle Font-Underline="True" ForeColor="#5555DD" />
<NodeStyle Font-Names="Tahoma"
Font-Size="10pt"
ForeColor="Black"
HorizontalPadding="5px"
NodeSpacing="0px"
VerticalPadding="0px" />
<ParentNodeStyle Font-Bold="False" />
<SelectedNodeStyle Font-Underline="True"
ForeColor="#5555DD"
HorizontalPadding="0px"
VerticalPadding="0px" />
</asp:TreeView>
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/Categories.xml">
</asp:XmlDataSource>
我应该从这个页面还是从 XmlDataSource 调用一些 Sql 命令?谢谢你的建议