Link to home
Start Free TrialLog in
Avatar of LarryZ
LarryZ

asked on

Don't want to display root XML node in TreeView

I'm Using Visual Studio 2005, FrameWork 2.0, ASP.NET 2.0

I have a Web page with a TreeView control, which is bound to filename StaffMenu.xml. Here is StaffMenu.xml:

<?xml version="1.0" encoding="utf-8" ?>

<Staff>
    <Menu name="Smith, Betty" url=""/>
    <Menu name="White, Gary" url=""/>
    <Menu name="Johnson, William" url=""/>
 </Staff>

Here is the TreView:

<asp:TreeView
        ID="TreeView1"
        runat="server"
        DataSourceID="XmlDataSource3" >
        <DataBindings>
            <asp:TreeNodeBinding
                DataMember="Menu"
                TextField="name"
                NavigateUrlField="url" />
        </DataBindings>
     </asp:TreeView>

Here is the binding:

<asp:XmlDataSource ID="XmlDataSource3" runat="server"  
    DataFile="~/App_Data/StaffMenu.xml" >
</asp:XmlDataSource>

I don't wan't the root node ("Staff") visible in the menu. The XML needs a root element, so I can't omit it. Can it be hidden somehow when TreeView displays the menu on the Web page, so the user only sees the three names?
ASKER CERTIFIED SOLUTION
Avatar of psk1
psk1

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial