2

Aspx

<asp:XmlDataSource runat="server" ID="TreeXml" EnableViewState="false" EnableCaching="false" />

<asp:TreeView ID="SelectTree" runat="server" DataSourceID="projectsTreeXml" AutoGenerateDataBindings="false">
     <DataBindings>
         <asp:TreeNodeBinding DataMember="A" TextField="DisplayID" ValueField="ID"/>
         <asp:TreeNodeBinding DataMember="B" TextField="DisplayID" ValueField="ID" />
     </DataBindings>
</asp:TreeView>

C# code

TreeXml.Data = getXMLString();
TreeXml.DataBind();
SelectCtrlTree.DataBind();

When I debug, the SelectTree has the dataSource successfully populated after DataBind() call, but the Nodes element is null, I think that should be ok.

The get getXMLString returns String

<?xml version="1.0" encoding="UTF-8" ?> 
- <Root>
 - <A ID="3063" Name="All Initiatives" DisplayID="Enterprise">
   <B ID="4911" Name="Closed - 2" DisplayID="Closed - 2"/>
  - <A ID="17902" Name="Corporate Programs" DisplayID="Corporate">
   - <A ID="25920" Name="In-flight Projects" DisplayID="In-flight">
      <B ID="3688" Name="Cash Flow BI Project" DisplayID="CORP00712" />  
     </A>
    </A>
   </A>
  </Root>

Have no clue why the UI does not show anything

crthompson
  • 15,653
  • 6
  • 58
  • 80

1 Answers1

0

I think your xml format is not absolutely right. Let you see this reference that how to bind xml data to treeview in asp.net. http://msdn.microsoft.com/en-us/library/494y92bs%28v=vs.100%29.aspx

Airwings
  • 111
  • 1
  • 4