Hi,
I'm populating a treeView with:
TreeNodeExpandMode.ServerSideCallBack
and:
My problem is that the tvScannedURLs.NodeExpand event is fires twice for every expand of a node on the tree.
It has no connection to the PostBack property of the page.
Any idea why?
Thanks,
Niv.
I'm populating a treeView with:
TreeNodeExpandMode.ServerSideCallBack
and:
<telerik:RadTreeView ID="tvScannedURLs" runat="server"
OnNodeExpand="tvScannedURLs_NodeExpand">
</telerik:RadTreeView>
My problem is that the tvScannedURLs.NodeExpand event is fires twice for every expand of a node on the tree.
It has no connection to the PostBack property of the page.
Any idea why?
Thanks,
Niv.
5 Answers, 1 is accepted
0
niv kfir
Top achievements
Rank 1
answered on 13 Aug 2010, 09:26 AM
I solved this by adding a flag - Set on the first time the event fires,
and reset on page PostBack.
Not very elegant, but works.
Thanks,
Niv.
and reset on page PostBack.
Not very elegant, but works.
Thanks,
Niv.
0
Ryan Ewing
Top achievements
Rank 1
answered on 26 Aug 2010, 07:04 PM
I have this same problem, I don't really understand what you did, but wrapped the entire function with an "If not e.node.hasControls then", If the node calling this has controls, I know the event has already been fired once.
Is there any progress on why this is happening?
Is there any progress on why this is happening?
0
Hello,
Could you please paste some sample code which will help us reproduce the issue?
Greetings,
Yana
the Telerik team
Could you please paste some sample code which will help us reproduce the issue?
Greetings,
Yana
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Ryan Ewing
Top achievements
Rank 1
answered on 27 Aug 2010, 09:12 PM
He is a simple example where this happens:
aspx
aspx.vb
aspx
<%@ Page Title="" Language="VB" MasterPageFile="~/Research.master" AutoEventWireup="false" CodeFile="treetest.aspx.vb" Inherits="treetest" %> <asp:Content ID="Content1" ContentPlaceHolderID="cHead" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="cc" Runat="Server"> <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> </telerik:RadScriptManager> <telerik:RadTreeView ID="RadTreeView1" runat="server" Height="300px" Width="400px" OnNodeExpand="RadTreeView1_NodeExpand"> </telerik:RadTreeView> </asp:Content>
aspx.vb
Partial Class treetest Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then For i As Integer = 0 To 10 Dim sectionNode As Telerik.Web.UI.RadTreeNode = New Telerik.Web.UI.RadTreeNode sectionNode.Text = i.ToString sectionNode.Value = i.ToString sectionNode.ExpandMode = Telerik.Web.UI.TreeNodeExpandMode.ServerSideCallBack sectionNode.PostBack = False RadTreeView1.Nodes.Add(sectionNode) Next End If End Sub Protected Sub RadTreeView1_NodeExpand(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadTreeNodeEventArgs) Handles RadTreeView1.NodeExpand Dim sectionNode As Telerik.Web.UI.RadTreeNode = e.Node For i As Integer = 0 To 10 Dim pageNode As Telerik.Web.UI.RadTreeNode = New Telerik.Web.UI.RadTreeNode pageNode.Text = sectionNode.Value & i.ToString pageNode.Value = sectionNode.Value & i.ToString sectionNode.Nodes.Add(pageNode) Next 'sectionNode.Expanded = True End Sub End Classif you put a breakpoint on radtreeview1_nodeExpand you will see that is fires twice for each click, also it put the subnodes in twice.
0
Hello Ryan,
You should subscribe to the event either in the markup or in the code-behind with "Handles", so please remove one of the these and the event will be fired only once as expected.
Kind regards,
Yana
the Telerik team
You should subscribe to the event either in the markup or in the code-behind with "Handles", so please remove one of the these and the event will be fired only once as expected.
Kind regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items