Hi,
with code like this, for example
''' <summary>
''' To store the path of last selected node
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Private Property LastSelectedNodeValuePath() As String
Get
Dim ret As String = ""
If Not ViewState("LastSelectedNodeValuePath") Is Nothing Then
ret = ViewState("LastSelectedNodeValuePath")
End If
Return ret
End Get
Set(ByVal value As String)
ViewState("LastSelectedNodeValuePath") = value
End Set
End Property
Protected Sub TreeView1_SelectedNodeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TreeView1.SelectedNodeChanged
'Change the select action of the last selected node
If LastSelectedNodeValuePath <> "" Then
TreeView1.FindNode(LastSelectedNodeValuePath).SelectAction = TreeNodeSelectAction.Select
End If
'Set the current selected node
LastSelectedNodeValuePath = TreeView1.SelectedNode.ValuePath
'Set current selected node's select action
TreeView1.SelectedNode.SelectAction = TreeNodeSelectAction.None
End Sub
Thanks,
Teemu Keiski
Finland, EU