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. TreeView

TreeView

Scheduled Pinned Locked Moved ASP.NET
designquestion
2 Posts 1 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
    Stephen Lintott
    wrote on last edited by
    #1

    Hi all. I am working on a page with a treeview on that state needs to be saved on postback(Meta Refresh). Now I've got the following code to create a cookie if a node is expanded

    Protected Sub tvSideNav_NodeExpanded(ByVal sender As Object, ByVal e As ComponentArt.Web.UI.TreeViewNodeEventArgs) Handles tvSideNav.NodeExpanded
    Try
    Dim i As Integer
    For i = 0 To Request.Cookies.Count - 1
    Request.Cookies.Remove(i)
    Next

            Dim UserCookie As HttpCookie = New HttpCookie("UserCookie")
            UserCookie.Name = "Details"
            UserCookie.Values.Add("node", tvSideNav.SelectedNode.GetCurrentIndex.ToString)
            Response.Cookies.Add(UserCookie)
        Catch ex As Exception
        End Try
    End Sub
    

    but this code doesn't seem to fire when a node is expanded. Can someone tell me why this is?

    Stephen Lintott Bsc IT (RAU)

    S 1 Reply Last reply
    0
    • S Stephen Lintott

      Hi all. I am working on a page with a treeview on that state needs to be saved on postback(Meta Refresh). Now I've got the following code to create a cookie if a node is expanded

      Protected Sub tvSideNav_NodeExpanded(ByVal sender As Object, ByVal e As ComponentArt.Web.UI.TreeViewNodeEventArgs) Handles tvSideNav.NodeExpanded
      Try
      Dim i As Integer
      For i = 0 To Request.Cookies.Count - 1
      Request.Cookies.Remove(i)
      Next

              Dim UserCookie As HttpCookie = New HttpCookie("UserCookie")
              UserCookie.Name = "Details"
              UserCookie.Values.Add("node", tvSideNav.SelectedNode.GetCurrentIndex.ToString)
              Response.Cookies.Add(UserCookie)
          Catch ex As Exception
          End Try
      End Sub
      

      but this code doesn't seem to fire when a node is expanded. Can someone tell me why this is?

      Stephen Lintott Bsc IT (RAU)

      S Offline
      S Offline
      Stephen Lintott
      wrote on last edited by
      #2

      I figured it out. In the aspx page in the treeview component you have to set the following.

      AutoPostBackOnNodeExpand ="true "

      Stephen Lintott Bsc IT (RAU)

      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