I have a ASP.Net TreeView control that I am binding to an XML data source. I'm wanting to be able to control which nodes are expanded and which ones are collapsed in the XML definition file. The Expanded='' doesn't work for me though. In the following simple example, I want Node 2 to be fully expanded.
ASP Page...
<asp:XmlDataSource ID="oXmlDataSource" runat="server" />
<asp:TreeView ID="TreeView1" runat="server" EnableViewState="false" DataSourceID="oXmlDataSource"></TreeView>
Code Behind...
oXmlDataSource.Data = MyXMLString;
oXmlDataSource.XPath = "/Tree/Node";
Here is the XML...
<?xml version='1.0' encoding='utf-8' ?>
<Tree Text='example.aspx' Href='example.aspx'>
<Node Text='Example Node 1' Href='0800200c9a66.aspx' Expanded='false'></Node>
<Node Text='Example Node 2' Href='0800200c9a66.aspx' Expanded='true'>
<Node Text='Example Node 3' Href='0800200c9a66.aspx' Expanded='false'></Node>
<Node Text='Example Node 4' Href='0800200c9a66.aspx' Expanded='false'></Node>
<Node Text='Example Node 5' Href='0800200c9a66.aspx' Expanded='false'></Node>
<Node Text='Example Node 6' Href='0800200c9a66.aspx' Expanded='false'></Node>
</Node>
</Tree>