12 个解决方案
#1
怎么没有人解答?好冷。
#2
有人帮忙吗?在线
#3
http://msdn.microsoft.com/library/default.asp?url=/workshop/WebControls/webcontrols_entry.asp
#4
全英文?头晕,有中文的吗?
#5
up
#6
顶
---
---
#7
有人解答吗?我都快上火了!
#8
因为没有看到你的XML文件,不好判断!
但我推荐你用以下的方法:
1.先将XML文件读入到DataSet中,用ReadXml等方法。
2.在针对DataSet操作TreeView控件,这样你好控制你的程序。
完全交给Treeview来管理XML是有缺陷的,要用自己的编码好控制!
但我推荐你用以下的方法:
1.先将XML文件读入到DataSet中,用ReadXml等方法。
2.在针对DataSet操作TreeView控件,这样你好控制你的程序。
完全交给Treeview来管理XML是有缺陷的,要用自己的编码好控制!
#9
Data Binding with XML and XSL Templates
In certain scenarios, it may be necessary to use XML data that is read-only, and it may also be in a format that cannot be directly used to data bind to the TreeView. The TreeView also supports Extensible Stylesheet Language (XSL) templates, which can be used to transform an XML file into a the correct format and structure. XSL can be used to transform XML files for data binding with both the TreeNode and TreeNodeType elements.
The following example shows how XML and XSL can be used to populate a TreeView.
Here is the markup for the TreeView element, which binds to an XML file, nodes.xml, and an XSL file, template.xsl.
<myxmltree:treeview
id="tree1"
runat="server"
TreeNodeSrc = "nodes.xml"
TreeNodeXsltSrc = "template.xsl"
/>
The nodes.xml file contains the following:
<?xml version="1.0" ?>
<HelpTOC>
<HelpTOCNode Title="Web Sites">
<HelpTOCNode Title = "Microsoft" Url = "http://www.microsoft.com">
</HelpTOCNode>
<HelpTOCNode Title = "MSDN" Url = "http://msdn.microsoft.com">
</HelpTOCNode>
</HelpTOCNode>
</HelpTOC>
The template.xsl file contains the following:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<xsl:template match="/">
<TREENODES>
<xsl:for-each select="HelpTOC/HelpTOCNode">
<xsl:element name="TreeNode">
<xsl:attribute name="Text" ><xsl:value-of select="@Title"/></xsl:attribute>
<xsl:attribute name="NavigateURL" ><xsl:value-of select="@Url"/></xsl:attribute>
<xsl:attribute name="TARGET" >main</xsl:attribute>
<xsl:for-each select="HelpTOCNode">
<xsl:element name="TreeNode">
<xsl:attribute name="Text" ><xsl:value-of select="@Title"/></xsl:attribute>
<xsl:attribute name="NavigateURL" ><xsl:value-of select="@Url"/></xsl:attribute>
<xsl:attribute name="Target" >main</xsl:attribute>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:for-each>
</TREENODES>
</xsl:template>
</xsl:stylesheet>
The XSL transforms the source XML into the correct format for the TreeView.
Warning The TREENODES and TREENODETYPES elements in a data binding source document must be uppercase for the TreeView data binding to work.
In certain scenarios, it may be necessary to use XML data that is read-only, and it may also be in a format that cannot be directly used to data bind to the TreeView. The TreeView also supports Extensible Stylesheet Language (XSL) templates, which can be used to transform an XML file into a the correct format and structure. XSL can be used to transform XML files for data binding with both the TreeNode and TreeNodeType elements.
The following example shows how XML and XSL can be used to populate a TreeView.
Here is the markup for the TreeView element, which binds to an XML file, nodes.xml, and an XSL file, template.xsl.
<myxmltree:treeview
id="tree1"
runat="server"
TreeNodeSrc = "nodes.xml"
TreeNodeXsltSrc = "template.xsl"
/>
The nodes.xml file contains the following:
<?xml version="1.0" ?>
<HelpTOC>
<HelpTOCNode Title="Web Sites">
<HelpTOCNode Title = "Microsoft" Url = "http://www.microsoft.com">
</HelpTOCNode>
<HelpTOCNode Title = "MSDN" Url = "http://msdn.microsoft.com">
</HelpTOCNode>
</HelpTOCNode>
</HelpTOC>
The template.xsl file contains the following:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<xsl:template match="/">
<TREENODES>
<xsl:for-each select="HelpTOC/HelpTOCNode">
<xsl:element name="TreeNode">
<xsl:attribute name="Text" ><xsl:value-of select="@Title"/></xsl:attribute>
<xsl:attribute name="NavigateURL" ><xsl:value-of select="@Url"/></xsl:attribute>
<xsl:attribute name="TARGET" >main</xsl:attribute>
<xsl:for-each select="HelpTOCNode">
<xsl:element name="TreeNode">
<xsl:attribute name="Text" ><xsl:value-of select="@Title"/></xsl:attribute>
<xsl:attribute name="NavigateURL" ><xsl:value-of select="@Url"/></xsl:attribute>
<xsl:attribute name="Target" >main</xsl:attribute>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:for-each>
</TREENODES>
</xsl:template>
</xsl:stylesheet>
The XSL transforms the source XML into the correct format for the TreeView.
Warning The TREENODES and TREENODETYPES elements in a data binding source document must be uppercase for the TreeView data binding to work.
#10
http://www.gotdotnet.com/team/webcontrols/treeview/tree2.aspx
http://www.gotdotnet.com/team/webcontrols/treeview/tree.aspx
还有这个
http://www.freevbcode.com/ShowCode.asp?ID=652
HOWTO: Populate a Treeview Control with an XML File
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q244954
http://msdn.microsoft.com/workshop/webcontrols/behaviors/library/treeview/treeview.asp
http://dev.csdn.net/article/28/28499.shtm
http://dev.csdn.net/article/28/28502.shtm
http://aspnet.4guysfromrolla.com/articles/051403-1.aspx
http://www.gotdotnet.com/team/webcontrols/treeview/tree.aspx
还有这个
http://www.freevbcode.com/ShowCode.asp?ID=652
HOWTO: Populate a Treeview Control with an XML File
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q244954
http://msdn.microsoft.com/workshop/webcontrols/behaviors/library/treeview/treeview.asp
http://dev.csdn.net/article/28/28499.shtm
http://dev.csdn.net/article/28/28502.shtm
http://aspnet.4guysfromrolla.com/articles/051403-1.aspx
#11
Treeview1.TreeNodeSrc=@"C:/Inetpub/wwwroot/ICBC_FJ/files/menu.xml"
路径应该用相对路径
路径应该用相对路径
#12
怎么无法给分了?!
#1
怎么没有人解答?好冷。
#2
有人帮忙吗?在线
#3
http://msdn.microsoft.com/library/default.asp?url=/workshop/WebControls/webcontrols_entry.asp
#4
全英文?头晕,有中文的吗?
#5
up
#6
顶
---
---
#7
有人解答吗?我都快上火了!
#8
因为没有看到你的XML文件,不好判断!
但我推荐你用以下的方法:
1.先将XML文件读入到DataSet中,用ReadXml等方法。
2.在针对DataSet操作TreeView控件,这样你好控制你的程序。
完全交给Treeview来管理XML是有缺陷的,要用自己的编码好控制!
但我推荐你用以下的方法:
1.先将XML文件读入到DataSet中,用ReadXml等方法。
2.在针对DataSet操作TreeView控件,这样你好控制你的程序。
完全交给Treeview来管理XML是有缺陷的,要用自己的编码好控制!
#9
Data Binding with XML and XSL Templates
In certain scenarios, it may be necessary to use XML data that is read-only, and it may also be in a format that cannot be directly used to data bind to the TreeView. The TreeView also supports Extensible Stylesheet Language (XSL) templates, which can be used to transform an XML file into a the correct format and structure. XSL can be used to transform XML files for data binding with both the TreeNode and TreeNodeType elements.
The following example shows how XML and XSL can be used to populate a TreeView.
Here is the markup for the TreeView element, which binds to an XML file, nodes.xml, and an XSL file, template.xsl.
<myxmltree:treeview
id="tree1"
runat="server"
TreeNodeSrc = "nodes.xml"
TreeNodeXsltSrc = "template.xsl"
/>
The nodes.xml file contains the following:
<?xml version="1.0" ?>
<HelpTOC>
<HelpTOCNode Title="Web Sites">
<HelpTOCNode Title = "Microsoft" Url = "http://www.microsoft.com">
</HelpTOCNode>
<HelpTOCNode Title = "MSDN" Url = "http://msdn.microsoft.com">
</HelpTOCNode>
</HelpTOCNode>
</HelpTOC>
The template.xsl file contains the following:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<xsl:template match="/">
<TREENODES>
<xsl:for-each select="HelpTOC/HelpTOCNode">
<xsl:element name="TreeNode">
<xsl:attribute name="Text" ><xsl:value-of select="@Title"/></xsl:attribute>
<xsl:attribute name="NavigateURL" ><xsl:value-of select="@Url"/></xsl:attribute>
<xsl:attribute name="TARGET" >main</xsl:attribute>
<xsl:for-each select="HelpTOCNode">
<xsl:element name="TreeNode">
<xsl:attribute name="Text" ><xsl:value-of select="@Title"/></xsl:attribute>
<xsl:attribute name="NavigateURL" ><xsl:value-of select="@Url"/></xsl:attribute>
<xsl:attribute name="Target" >main</xsl:attribute>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:for-each>
</TREENODES>
</xsl:template>
</xsl:stylesheet>
The XSL transforms the source XML into the correct format for the TreeView.
Warning The TREENODES and TREENODETYPES elements in a data binding source document must be uppercase for the TreeView data binding to work.
In certain scenarios, it may be necessary to use XML data that is read-only, and it may also be in a format that cannot be directly used to data bind to the TreeView. The TreeView also supports Extensible Stylesheet Language (XSL) templates, which can be used to transform an XML file into a the correct format and structure. XSL can be used to transform XML files for data binding with both the TreeNode and TreeNodeType elements.
The following example shows how XML and XSL can be used to populate a TreeView.
Here is the markup for the TreeView element, which binds to an XML file, nodes.xml, and an XSL file, template.xsl.
<myxmltree:treeview
id="tree1"
runat="server"
TreeNodeSrc = "nodes.xml"
TreeNodeXsltSrc = "template.xsl"
/>
The nodes.xml file contains the following:
<?xml version="1.0" ?>
<HelpTOC>
<HelpTOCNode Title="Web Sites">
<HelpTOCNode Title = "Microsoft" Url = "http://www.microsoft.com">
</HelpTOCNode>
<HelpTOCNode Title = "MSDN" Url = "http://msdn.microsoft.com">
</HelpTOCNode>
</HelpTOCNode>
</HelpTOC>
The template.xsl file contains the following:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<xsl:template match="/">
<TREENODES>
<xsl:for-each select="HelpTOC/HelpTOCNode">
<xsl:element name="TreeNode">
<xsl:attribute name="Text" ><xsl:value-of select="@Title"/></xsl:attribute>
<xsl:attribute name="NavigateURL" ><xsl:value-of select="@Url"/></xsl:attribute>
<xsl:attribute name="TARGET" >main</xsl:attribute>
<xsl:for-each select="HelpTOCNode">
<xsl:element name="TreeNode">
<xsl:attribute name="Text" ><xsl:value-of select="@Title"/></xsl:attribute>
<xsl:attribute name="NavigateURL" ><xsl:value-of select="@Url"/></xsl:attribute>
<xsl:attribute name="Target" >main</xsl:attribute>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:for-each>
</TREENODES>
</xsl:template>
</xsl:stylesheet>
The XSL transforms the source XML into the correct format for the TreeView.
Warning The TREENODES and TREENODETYPES elements in a data binding source document must be uppercase for the TreeView data binding to work.
#10
http://www.gotdotnet.com/team/webcontrols/treeview/tree2.aspx
http://www.gotdotnet.com/team/webcontrols/treeview/tree.aspx
还有这个
http://www.freevbcode.com/ShowCode.asp?ID=652
HOWTO: Populate a Treeview Control with an XML File
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q244954
http://msdn.microsoft.com/workshop/webcontrols/behaviors/library/treeview/treeview.asp
http://dev.csdn.net/article/28/28499.shtm
http://dev.csdn.net/article/28/28502.shtm
http://aspnet.4guysfromrolla.com/articles/051403-1.aspx
http://www.gotdotnet.com/team/webcontrols/treeview/tree.aspx
还有这个
http://www.freevbcode.com/ShowCode.asp?ID=652
HOWTO: Populate a Treeview Control with an XML File
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q244954
http://msdn.microsoft.com/workshop/webcontrols/behaviors/library/treeview/treeview.asp
http://dev.csdn.net/article/28/28499.shtm
http://dev.csdn.net/article/28/28502.shtm
http://aspnet.4guysfromrolla.com/articles/051403-1.aspx
#11
Treeview1.TreeNodeSrc=@"C:/Inetpub/wwwroot/ICBC_FJ/files/menu.xml"
路径应该用相对路径
路径应该用相对路径
#12
怎么无法给分了?!