Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Tree view control

Tree view control

Scheduled Pinned Locked Moved ASP.NET
htmlsysadmindata-structuresxmlquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    anandhakrishnan
    wrote on last edited by
    #1

    Hi, I am using a Treeview control with xml file as source file. I have given the html source code below. <asp:TreeView ID="TreeLeftNavigation" runat="server" DataSourceID="XmlDataSource1" ImageSet="Simple" OnTreeNodePopulate="TreeLeftNavigation_TreeNodePopulate" > <DataBindings> <asp:TreeNodeBinding DataMember="Countries" Text="Countries" Value="Countries" /> <asp:TreeNodeBinding DataMember="continent" TextField="cont" /> <asp:TreeNodeBinding DataMember="country" TextField="coun" /> <asp:TreeNodeBinding DataMember="language" TextField="lang" NavigateUrlField="Url"/> <asp:TreeNodeBinding DataMember="captial" TextField="cap" /> <asp:TreeNodeBinding DataMember="cities" TextField="city" /> </DataBindings> <ParentNodeStyle Font-Bold="False" /> <HoverNodeStyle Font-Underline="True" ForeColor="#5555DD" /> <SelectedNodeStyle Font-Underline="True" ForeColor="#5555DD" HorizontalPadding="0px" VerticalPadding="0px" /> <NodeStyle Font-Names="Tahoma" Font-Size="10pt" ForeColor="Black" HorizontalPadding="0px" NodeSpacing="0px" VerticalPadding="0px" /> </asp:TreeView> <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/XMLFile.xml"></asp:XmlDataSource> This is my xml file content. <?xml version="1.0" encoding="utf-8" ?> <Countries> <continent cont="NorthAmerica"> <country coun="United States of America"> <language lang="English" Url="Header.aspx"></language> <capital cap="Washington D.C"></capital> <cities city="Chicago"></cities> </country> </continent> <continent cont="Europe"> <country coun="United Kingdom"> <language lang=" English" Url="Header.aspx"></language> <capital cap="London"></capital> <cities city="Bristol"></cities> </country> </continent> </Countries> Here i have given the url link in xml file. I am getting the url v

    V 1 Reply Last reply
    0
    • A anandhakrishnan

      Hi, I am using a Treeview control with xml file as source file. I have given the html source code below. <asp:TreeView ID="TreeLeftNavigation" runat="server" DataSourceID="XmlDataSource1" ImageSet="Simple" OnTreeNodePopulate="TreeLeftNavigation_TreeNodePopulate" > <DataBindings> <asp:TreeNodeBinding DataMember="Countries" Text="Countries" Value="Countries" /> <asp:TreeNodeBinding DataMember="continent" TextField="cont" /> <asp:TreeNodeBinding DataMember="country" TextField="coun" /> <asp:TreeNodeBinding DataMember="language" TextField="lang" NavigateUrlField="Url"/> <asp:TreeNodeBinding DataMember="captial" TextField="cap" /> <asp:TreeNodeBinding DataMember="cities" TextField="city" /> </DataBindings> <ParentNodeStyle Font-Bold="False" /> <HoverNodeStyle Font-Underline="True" ForeColor="#5555DD" /> <SelectedNodeStyle Font-Underline="True" ForeColor="#5555DD" HorizontalPadding="0px" VerticalPadding="0px" /> <NodeStyle Font-Names="Tahoma" Font-Size="10pt" ForeColor="Black" HorizontalPadding="0px" NodeSpacing="0px" VerticalPadding="0px" /> </asp:TreeView> <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/XMLFile.xml"></asp:XmlDataSource> This is my xml file content. <?xml version="1.0" encoding="utf-8" ?> <Countries> <continent cont="NorthAmerica"> <country coun="United States of America"> <language lang="English" Url="Header.aspx"></language> <capital cap="Washington D.C"></capital> <cities city="Chicago"></cities> </country> </continent> <continent cont="Europe"> <country coun="United Kingdom"> <language lang=" English" Url="Header.aspx"></language> <capital cap="London"></capital> <cities city="Bristol"></cities> </country> </continent> </Countries> Here i have given the url link in xml file. I am getting the url v

      V Offline
      V Offline
      VijayVishwakarma
      wrote on last edited by
      #2

      try this for your solutions I hope it works for u. protected void Node_Populate(object sender, System.Web.UI.WebControls.TreeNodeEventArgs e) { if (e.Node.ChildNodes.Count == 0) { switch (e.Node.Depth) { case 0: function(e.Node); //here u can get the node value break; } } }

      Vijay V. Yash Softech

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups