NodeClick clears out the content of Node Templates

2 posts, 0 answers
  1. Peter
    Peter avatar
    3 posts
    Member since:
    Oct 2008

    Posted 20 Nov 2008 Link to this post


    I’ve got a problem with the server-side Event „.NodeClick“. Every time the Ajax postback is complete all nodes from the selected nodes up to the root nodes and all its child nodes in the tree view got cleared out. They only show their + or – images and the Line Images.  I use a default node template with a label in it. Without templates it only resets properties like „ForeColor” to black, but the text stays visible.  I also use Client-Side Load On Demand with „ServerSideCallback“. The NodeClick event changes some text in a label on the webform.  Booth, the tree view and the label are located in separated updatepannels. I’ve created a sample project to eliminate side effects generated by my other code but the problem is still present.  Can someone tell me what I’m doing wrong?

    There is also another problem with the loading image I use in the LoadingStatusTemplate. If I use Node Templates, the image never shows up on the right side of the node but on its bottom side. Without Node Templates it shows up at the right side like expected. Is there a way to get the image on the right end of the node when I’m using Node Templates?

    Thanks a lot for your help!

    This is the code of my sample project:

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="frmTest2.aspx.vb" Inherits="frmTest2" %> 
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> 
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" ""> 
    <html xmlns=""
    <head id="Head1" runat="server"
        <title>Untitled Page</title> 
        <form id="form1" runat="server"
        <asp:ScriptManager ID="ScriptManager1" runat="server"
            <asp:UpdatePanel ID="UpdatePanel1" runat="server"
                    <asp:Button ID="Button1" runat="server" Text="poppulate!" /> 
                    <asp:Label ID="lbltest" runat="server" Text="Label"></asp:Label> 
            <asp:UpdatePanel ID="UpdatePanel2" runat="server"
                    <telerik:RadTreeView ID="rtvAtcTree" runat="server" LoadingStatusPosition="AfterNodeText" 
                        EnableDragAndDrop="True" EnableDragAndDropBetweenNodes="True" TabIndex="1" EnableEmbeddedSkins="True"
                        <CollapseAnimation Type="OutQuint" Duration="100"></CollapseAnimation> 
                        <ExpandAnimation Duration="100"></ExpandAnimation> 
                            <asp:Label ID="lblNodeText" runat="server" Text=""></asp:Label> 
                            <img src="Images/loading.gif" alt="" /> 

    Imports System 
    Imports System.Data 
    Imports System.Collections.Generic 
    Imports Telerik.Web.UI 
    Partial Class frmTest2 
        Inherits System.Web.UI.Page 
        Protected Sub rtvAtcTree_NodeClick(ByVal sender As ObjectByVal e As Telerik.Web.UI.RadTreeNodeEventArgs) Handles rtvAtcTree.NodeClick 
            lbltest.Text = Now 
        End Sub 
        Protected Sub rtvAtcTree_NodeExpand(ByVal sender As ObjectByVal e As RadTreeNodeEventArgs) Handles rtvAtcTree.NodeExpand 
            e.Node.Expanded = True 
        End Sub 
        Private Sub RenderSubNodes(ByVal ParentNode As RadTreeNode) 
            For i As Integer = 0 To 3 
                Dim n As New RadTreeNode 
                n.ExpandMode = TreeNodeExpandMode.ServerSideCallBack 
                If ParentNode Is Nothing Then 
                End If 
                ApplyNodeText(n, "Text"
        End Sub 
        Private Sub ApplyNodeText(ByVal node As RadTreeNode, ByVal txt As String
            Dim lblNodeText As Label 
            lblNodeText = node.FindControl("lblNodeText"
            lblNodeText.Text = txt 
        End Sub 
        Protected Sub Button1_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles Button1.Click 
        End Sub 
    End Class 

  2. Peter
    Peter avatar
    3 posts
    Member since:
    Oct 2008

    Posted 21 Nov 2008 Link to this post

    I solved the problem by changing the ExpandMode from “ServerSideCallBack” to “ServerSide”. But I’m still confused about why this happens. Also this solution reduces the performance in a significant way on already loaded nodes…

Back to Top