Home - Forums-.NET - FlyTreeView (ASP.NET) - Yellow page if sending a postback after expanding the tree

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

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

Yellow page if sending a postback after expanding the tree
Link Posted: 18-Oct-2007 00:39
Hi, I have a tree with 2 levels. If I expand one of the root-nodes and click after that on my imagebutton, which is sending a postback to the server, I get the following error: Cannot find node (n7pk82l9t) in the treeview hierarchy that should handle client-side event: _5n Stack Trace: [NullReferenceException: Cannot find node (n7pk82l9t) in the treeview hierarchy that should handle client-side event: _5n] NineRays.WebControls.FlyTreeView.ApplyStateLog(String stateLog) +6542 NineRays.WebControls.FlyTreeView.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +48 System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +718 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3776 Here is my code: .aspx:

.cs: public partial class ProjectTreeView : BaseForm { protected int status; protected override void Page_Load(object sender, System.EventArgs e) { base.Page_Load(sender, e); } private void imgBtnShowAll_ServerClick(object sender, System.Web.UI.ImageClickEventArgs e) { this.status = Project.STATUS_ALL; } private void imgBtnShowActive_ServerClick(object sender, System.Web.UI.ImageClickEventArgs e) { this.status = Project.STATUS_ACTIVE; } }
Link Posted: 18-Oct-2007 03:53
I removed several external references (like  base.Page_Load and Project) from your code-behind:

protected int status;

private void imgBtnShowAll_ServerClick(object sender, System.Web.UI.ImageClickEventArgs e)
{
}

private void imgBtnShowActive_ServerClick(object sender, System.Web.UI.ImageClickEventArgs e)
{
}


So it works ok here.

It looks like you're doing something wrong with treeview or page state. So treeview cannot find node by ID to apply client-side event to.
Link Posted: 18-Oct-2007 04:51
I tried this now as well. I directly inherit from System.Web.UI.Page (and no more from my BaseForm.cs); I removed everything from all methods .. If I expand a root node and then click on one of my buttons: I still get the error.

I do not understand what kind of client event that is and why it is necessary to find a node in the tree, at all. I did not define a client event for a node or the tree, especially not one called \"_5n\". I got the error too, as I defined the SelectedNodeChanged-Event for my tree and then expanded the tree.

Do you have any idea, what I am doing wrong with the treeview or the page state? Sorry, I am at a loss with this!
Link Posted: 18-Oct-2007 06:01
I have your code running well here. You can try to create an empty web project and put your code to ensure that it works ok and that issue is somewhere else.

I'll try to explain the internal routines.

Every time you perform any client-side action with a node (select/check/expand/collapse/etc.) , treeview logs the action into hidden input field in the form of [\"nodeID\", \"action description\"]. So when page is posted back, treeview can reproduce all your client-side operations and apply changes one-by-one to treeview structure. That's why node ID is required to find node and apply changes to it (in your case it can be node selection).

Please try to create empty web project and put your test case to it. If you still experience any problems, we can take it from you and fix possible bugs.
Link Posted: 02-Nov-2007 03:31
Thank you, now it works ..