This is a migrated thread and some comments may be shown as answers.

Tree View on Node Click on firing

1 Answer 106 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Sagar
Top achievements
Rank 1
Sagar asked on 16 Dec 2011, 07:23 PM
i have a problem with the OnNodeClick event in the tree view. I have the following code in ascx file :

<telerik:RadAjaxLoadingPanel  ID = "RadAjaxLoadingPanel1" runat ="server"></telerik:RadAjaxLoadingPanel>
        <telerik:RadAjaxPanel ID = "RadAjaxPanel" runat = "server" >
            <telerik:RadTreeView ID ="RadTreeView1" runat ="server" Width ="100%" OnNodeExpand = "RadTreeView1_NodeExpand" LoadingStatusPosition ="BeforeNodeText"
                OnNodeClick = "RadTreeView1_NodeClick"  >                            
            </telerik:RadTreeView>
        </telerik:RadAjaxPanel>

And i am adding the nodes in the code behind:

My code behind:

Private Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        LoadRootNodes(RadTreeView1, TreeNodeExpandMode.ServerSideCallBack)
    End Sub
 
Private Shared Sub LoadRootNodes(ByVal treeView As RadTreeView, ByVal expandMode As TreeNodeExpandMode)
        Dim RootNode As New RadTreeNode()
        RootNode.Text = "Guest"
        RootNode.Value = "1"
        RootNode.ExpandMode = expandMode
        treeView.Nodes.Add(RootNode)
    End Sub
 
Protected Sub RadTreeView1_NodeExpand(ByVal sender As Object, ByVal e As RadTreeNodeEventArgs)
        PopulateNodeOnDemand(e, TreeNodeExpandMode.ServerSideCallBack)
    End Sub
 
Private Shared Sub PopulateNodeOnDemand(ByVal e As RadTreeNodeEventArgs, ByVal expandMode As TreeNodeExpandMode)
        For i As Integer = 1 To 10
            Dim childNode As New RadTreeNode
            childNode.Text = i.ToString
            childNode.Value = i.ToString
            e.Node.Nodes.Add(childNode)
        Next
        e.Node.Expanded = True
    End Sub
 
Protected Sub RadTreeView1_NodeClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadTreeNodeEventArgs)
        Dim str As String = e.Node.Value
    End Sub
 
On Init i am just loading one root node guest, and when Expand is clicked, i am populating
1 to 10 as child nodes. Now, when i click on one of the nodes, i can hit the break point  at RadTreeView1_NodeClick and when i run, the tree is getting populated and
everything is fine. Now, my problem is, when i click another node, i CANT hit
the break point(on the second node click) and the tress is also not getting
populated. I can just see "Guest" and not the below nodes. Can any one
please help me. Thanks

1 Answer, 1 is accepted

Sort by
0
Sagar
Top achievements
Rank 1
answered on 16 Dec 2011, 08:10 PM
This is fixed. Thanks. I have EnableViewState="false" and i changed it. Thanks
Tags
TreeView
Asked by
Sagar
Top achievements
Rank 1
Answers by
Sagar
Top achievements
Rank 1
Share this question
or