SelectedNodeChanged Event Not Fired for TreeView

asn1981

Active member
Joined
Mar 15, 2005
Messages
38
Programming Experience
Beginner
I have a .Net 2.0 treeview control on my ASP.net website.
the issue i have is that when a dynamically created treenode has been created and then is clicked..
the page is not posted back and the SelectedNodeChanged event does not get fired.
below i have shown my code that created the treenode
i have tried setting the TreeNode SelectAction as both select and selectAction neither of which makes any difference is firing the SelectedNodeChanged event.

VB.NET:
Private Sub DotvNavigation()
        'build the tvNavigation

        tvNavigation.Nodes.Clear()
        Dim RootTreeNode As New TreeNode
        RootTreeNode.Text = "System Name"
        tvNavigation.Nodes.Add(RootTreeNode)

        datareader = GetSqlData.GetNodes4Navigation
        While datareader.Read
            If datareader.HasRows = True Then
                Dim iCount As Integer
                Dim iParentMenuID As Integer = datareader(0)
                Dim sMenuItemName As String = datareader(1)
                Dim iMenuID As Integer = datareader(2)

                Dim TreeNode As New TreeNode
                TreeNode.Text = sMenuItemName
                TreeNode.Value = iMenuID


                'TreeNode.SelectAction = TreeNodeSelectAction.Select
                TreeNode.SelectAction = TreeNodeSelectAction.SelectExpand

                RootTreeNode.ChildNodes.Add(TreeNode)
               
        End While

    End Sub
 
Nodes.clear and dynamically adding treenodes is not a problem regarding the SelectedNodeChanged event, I just tested this and it works right out of the box. It must be something else.
 
Should not be, and is not here - and nothing special configured. (You can display 'Environment.Version.ToString' somewhere to see which CLR version a specific Asp.Net application is run by.)
Attached is the working test site.
 

Attachments

  • WebSite1.zip
    1.9 KB · Views: 40
Back
Top