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. Selection of Treeview node during page load

Selection of Treeview node during page load

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

    I have a treeview control whose particular node needs to be dynamically selected during page load. Kindly let me know the way to do this.

    A 1 Reply Last reply
    0
    • S shehezada

      I have a treeview control whose particular node needs to be dynamically selected during page load. Kindly let me know the way to do this.

      A Offline
      A Offline
      ajtunbridge
      wrote on last edited by
      #2

      TreeView treeView = new TreeView();
      treeView.Nodes.Add("Monday");
      treeView.Nodes.Add("Tuesday");

      treeView.SelectedNode = treeView.Nodes[1];

      Something like that anyway :) This would select the "Tuesday" node.

      S 1 Reply Last reply
      0
      • A ajtunbridge

        TreeView treeView = new TreeView();
        treeView.Nodes.Add("Monday");
        treeView.Nodes.Add("Tuesday");

        treeView.SelectedNode = treeView.Nodes[1];

        Something like that anyway :) This would select the "Tuesday" node.

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

        No this does not work. Thanks anyways. The scenario is something like this. 1. On one page I have a tree view. 2. I select a node and add the node vale in a session variable. 3. On another page I have the treeview. 4. Here I fetch the session variable i.e. the selected node value. Now I have to use this variable to automatically select the same node.

        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