040. asp.netWeb中TreeView控件绑定XML文件

xml文件格式:

<?xml version="1.0" encoding="utf-8" ?>
<sitemap title="进销存管理中心" value="a0" description="进销存管理中心" imgUrl="~/Themes/Images/Navigation/Cube.bmp"> <sitefolder url="" title="系统设置" value="d1" description="系统设置" imgUrl="~/Themes/Images/Navigation/folder.gif">
<sitenode url="" value="d2" title="部门设置" description="部门设置" target="_self" imgUrl="~/Themes/Images/Navigation/page.gif"/>
<sitenode url="" value="d3" title="数据字典设置" description="数据字典设置" target="_self" imgUrl="~/Themes/Images/Navigation/page.gif"/>
</sitefolder> <sitefolder url="" title="职责范围" value="d1" description="职责范围" imgUrl="~/Themes/Images/Navigation/folder.gif">
<sitenode url="" value="d2" title="经理职责" description="经理职责" target="_self" imgUrl="~/Themes/Images/Navigation/page.gif"/>
<sitenode url="" value="d3" title="门卫职责" description="门卫职责" target="_self" imgUrl="~/Themes/Images/Navigation/page.gif"/>
</sitefolder> </sitemap>

拖动一个TreeViee控件到界面:

040. asp.netWeb中TreeView控件绑定XML文件

选择或创建一个数据源, 编辑TreeNode到数据源的绑定:

040. asp.netWeb中TreeView控件绑定XML文件

aspx中对应的代码:

<div style="height: 495px; overflow: auto; width: 100%;">
<asp:TreeView ID="tvNavigation" runat="server" ExpandDepth="5" Width="100%" SkinID="MSDN"
DataSourceID="treeSource">
<DataBindings>
<asp:TreeNodeBinding DataMember="sitemap" ImageUrlField="imgUrl" SelectAction="Expand"
TextField="title" ToolTipField="description" ValueField="value" />
<asp:TreeNodeBinding DataMember="sitefolder" ImageUrlField="imgUrl" SelectAction="Expand"
TextField="title" ToolTipField="description" ValueField="value" />
<asp:TreeNodeBinding DataMember="sitefolder" ImageUrlField="imgUrl" SelectAction="Expand"
TextField="title" ToolTipField="description" ValueField="value" />
<asp:TreeNodeBinding DataMember="sitefolder" ImageUrlField="imgUrl" SelectAction="Expand"
TextField="title" ToolTipField="description" ValueField="value" />
<asp:TreeNodeBinding DataMember="sitenode" ImageUrlField="imgUrl" NavigateUrlField="url"
TextField="title" ToolTipField="description" ValueField="value" />
</DataBindings>
</asp:TreeView>
<asp:XmlDataSource ID="treeSource" runat="server" DataFile="~/Themes/Xml/SiteMap.xml">
</asp:XmlDataSource>
</div>
上一篇:ARM指令集——条件执行、内存操作指令、跳转指令


下一篇:ARM指令集(上)