NodeExpand event firing twice

6 posts, 0 answers
  1. jorge
    jorge avatar
    23 posts
    Member since:
    Apr 2007

    Posted 10 Apr 2008 Link to this post

    I am trying to implement load on demand on a tree.  For some reason the NodeExpand event is firing twice duplicating the nodes. 

    Here is the ASPX code:

    <%@ Page Language="VB" ValidateRequest="False" AutoEventWireup="true" CodeFile="layerProfiles.aspx.vb" Inherits="layerProfiles" %> 
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     
    <html xmlns="http://www.w3.org/1999/xhtml">  
    <head runat="server">  
        <title>Layer Profiles</title> 
    </head> 
    <body> 
        <form id="form1" runat="server">  
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 
        <div style="width: 250px; float:left">  
            <telerik:RadTreeView ID="availableLayersTree" runat="server" OnNodeExpand="availableLayersTree_NodeExpand">  
            </telerik:RadTreeView> 
        </div> 
        <div style="width: 250px; float:left">  
            <telerik:RadTreeView ID="userTree" runat="server">  
                <CollapseAnimation Type="OutQuint" Duration="100" /> 
                <ExpandAnimation Duration="100" /> 
            </telerik:RadTreeView> 
        </div> 
        </form> 
    </body> 
    </html> 
     

    and the VB code, modified just to test adding a single node:
    Imports Telerik.Web.UI  
     
    Partial Class layerProfiles  
        Inherits System.Web.UI.Page  
     
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load  
            If Not Page.IsPostBack Then  
                'generateTree()  
                loadRootNodes()  
            End If  
        End Sub  
     
        Private Sub loadRootNodes()  
            Dim oRootGroups As New GeoNet.LayerGroupsCollection  
            oRootGroups.LoadGroups(False)  
     
            Dim oGroup As GeoNet.LayerGroup  
            Dim oParentNode As RadTreeNode  
            For Each oGroup In oRootGroups  
                If oGroup.ShowInLegend = "true" Then  
                    oParentNode = New RadTreeNode(oGroup.LegendLabel, oGroup.ID)  
                    oParentNode.ExpandMode = TreeNodeExpandMode.ServerSideCallBack  
                    availableLayersTree.Nodes.Add(oParentNode)  
                End If  
            Next  
            oParentNode = New RadTreeNode("New Layer Profile")  
            userTree.Nodes.Add(oParentNode)  
        End Sub  
     
        Protected Sub availableLayersTree_NodeExpand(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadTreeNodeEventArgs) Handles availableLayersTree.NodeExpand  
            'Dim oAuxGroupsCollection As New GeoNet.LayerGroupsCollection  
            'Dim oOriginatingGroup As New GeoNet.LayerGroup(e.Node.Value)  
            'oOriginatingGroup.Children = oAuxGroupsCollection.BuildGroupTree(oOriginatingGroup)  
     
            'If Not oOriginatingGroup.Children Is Nothing Then  
            '    Dim oChildGroup As GeoNet.LayerGroup  
            '    For Each oChildGroup In oOriginatingGroup.Children  
            '        If oChildGroup.ShowInLegend = "true" Then  
            e.Node.Nodes.Add(New RadTreeNode("test", "100"))  
            '        End If  
            '    Next  
            e.Node.Expanded = True 
            e.Node.ExpandMode = TreeNodeExpandMode.ClientSide  
            'End If  
        End Sub  
    End Class  
     

    What setting am I missing?
  2. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 10 Apr 2008 Link to this post

    Hello jorge,

    I suggest that you remove OnNodeExpand="availableLayersTree_NodeExpand"
    from the treeview declaration (since in the .vb file you already have Handles availableLayersTree.NodeExpand)

    I hope this helps.

    Regards,
    Veskoni
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. jorge
    jorge avatar
    23 posts
    Member since:
    Apr 2007

    Posted 10 Apr 2008 Link to this post

    Veskoni,

    Thank you for the prompt response.  Yeah, that did it.  I suggest you check the code on your online example since it also has OnNodeExpand="RadTreeView1_NodeExpand".

    Jorge
  5. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 10 Apr 2008 Link to this post

    Hi jorge,

    We already fixed that. It will be available on the site next week when we are releasing the official Q1 version of the Prometheus controls.

    Sincerely yours,
    Veskoni
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. jorge
    jorge avatar
    23 posts
    Member since:
    Apr 2007

    Posted 10 Apr 2008 Link to this post

    Excellent, thanks again for the outstanding support.

    Jorge
  7. Gordon Buxton
    Gordon Buxton avatar
    7 posts
    Member since:
    Dec 2005

    Posted 06 Jun 2008 Link to this post

    I had exactly the same issue, caused by copying and pasting the sample code, which does not seem to have been updated yet!

    At least I learned something.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017