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. General Programming
  3. C#
  4. Treeview Control

Treeview Control

Scheduled Pinned Locked Moved C#
questiondata-structureshelp
5 Posts 3 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.
  • S Offline
    S Offline
    shehezada
    wrote on last edited by
    #1

    I want to have a tree node selected when the page loads. I have the number or ID or value of the node when the page loads. how do i achieve this? please help.

    K 1 Reply Last reply
    0
    • S shehezada

      I want to have a tree node selected when the page loads. I have the number or ID or value of the node when the page loads. how do i achieve this? please help.

      K Offline
      K Offline
      Kjetil Svendsen
      wrote on last edited by
      #2

      Hi. first you have to find the node: TreeView.Nodes.Find Then select it: TreeView.SelectedNode = And you can do other stuff: TreeNode.Expand(); TreeNode.EnsureVisible(); Kjetil

      S 1 Reply Last reply
      0
      • K Kjetil Svendsen

        Hi. first you have to find the node: TreeView.Nodes.Find Then select it: TreeView.SelectedNode = And you can do other stuff: TreeNode.Expand(); TreeNode.EnsureVisible(); Kjetil

        S Offline
        S Offline
        shehezada
        wrote on last edited by
        #3

        Hi Kjetil, Thanks a ton. It didn't work. Maybe you are talking about a windows-based TreeView control. I am using the control on a webpage. The TreeView.Nodes.Find function doesnot exist.

        D K 2 Replies Last reply
        0
        • S shehezada

          Hi Kjetil, Thanks a ton. It didn't work. Maybe you are talking about a windows-based TreeView control. I am using the control on a webpage. The TreeView.Nodes.Find function doesnot exist.

          D Offline
          D Offline
          DaveyM69
          wrote on last edited by
          #4

          shehezada wrote:

          TreeView.Nodes.Find function doesnot exist

          In that case you may have to iterate through all the nodes and check it's value/ID or whatever you need - when you find a match, set the selectednode property and break out of your loop.

          Dave

          1 Reply Last reply
          0
          • S shehezada

            Hi Kjetil, Thanks a ton. It didn't work. Maybe you are talking about a windows-based TreeView control. I am using the control on a webpage. The TreeView.Nodes.Find function doesnot exist.

            K Offline
            K Offline
            Kjetil Svendsen
            wrote on last edited by
            #5

            Hi Sorry. My mistake. I'm in a big WinForm project, and have "forgotten" all about Web :-) Kjetil

            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