Home - Forums-.NET - FlyTreeView (ASP.NET) - Problem with flytreeview with Ajax

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

This forum related to following products: FlyTreeView for ASP.NET

Problem with flytreeview with Ajax
Link Posted: 20-Mar-2009 06:27
Hello,

I am having trouble trying to get my flytreeview to work in an Ajax UpdatePanel.  I am displaying my flytreeview in a child pop-up window.  Using  VB and OnSelectedNodeChangedJavascript to handle node selection.  The flytreeview renders fine but when when a click a node to expand, nothing happens.  If I click more than once, my screen goes crazy or get an IE not responding message.

In Page_Load have:  Page.ClientScript.GetPostBackEventReference(Me, "")

If I set ForceAjaxRenderer to True, get FlyTreeView internal exception (code 63818)

Thanks for your help.
Link Posted: 20-Mar-2009 07:48
Do you have any source code to reproduce your issue?
Link Posted: 25-Mar-2009 02:31
Sorry, I haven't posted the code yet.  The page is complicated and need to simplify to post.  Also, working against a fast approaching deadline, so decided not to put the flytreeview in an updatepanel for now.

Do you have an example of flytreeview in an updatepanel and uses OnSelectedNodeChangedJavascript?  Just getting start with Ajax, but successfully have other controls on the page working in updatepanels.

Thanks.
Link Posted: 25-Mar-2009 02:44
OK, just took recent code and modified it a bit: [code] <%@ Register Assembly="NineRays.WebControls.FlyTreeView" Namespace="NineRays.WebControls" TagPrefix="NineRays" %>
function nodeSelected(sender, oldNode, newNode) { alert(newNode.getText()); } [/code] Code-behind: [code]Imports System.IO Imports NineRays.WebControls Partial Public Class test1 Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load AddNodes(flyTreeView.Nodes, "c:\") End Sub Public Shared Sub AddNodes(ByVal nodes As FlyTreeNodeCollection, ByVal directoryPath As String) Dim directory As New DirectoryInfo(directoryPath) If Not directory.Exists Then Return End If Dim subDirectories As DirectoryInfo() = directory.GetDirectories() For Each subDir As DirectoryInfo In subDirectories Dim ftn As New FlyTreeNode() ftn.Text = HttpUtility.HtmlEncode(subDir.Name) ftn.Value = subDir.FullName nodes.Add(ftn) Try ' do not set populate on demand for nodes that have no nested directories ftn.PopulateNodesOnDemand = subDir.GetDirectories().Length > 0 Catch ex As Exception ' add a child node that shows that there was an exception trying to get its child nodes 'AddExceptionNode(ftn.ChildNodes, ex) End Try Next End Sub Protected Sub flyTreeView_NodeSelected(ByVal sender As Object, ByVal e As NineRays.WebControls.FlyTreeNodeEventArgs) Handles flyTreeView.NodeSelected ' ScriptManager.RegisterStartupScript(Me, Me.GetType(), "downloadassssslert", "alert('permission is denied.');", True) lbl1.Text = "Updated..." UpdatePanel1.Update() End Sub Protected Sub flyTreeView_PopulateNodes(ByVal sender As Object, ByVal e As NineRays.WebControls.FlyTreeNodeEventArgs) Handles flyTreeView.PopulateNodes AddNodes(e.Node.ChildNodes, e.Node.Value) End Sub End Class[/code]