I am having an issue where whenever a post back is triggered on my page the Web Data Tree empties out. Even though I'm rebinding the control on post back it still empties every time.
Hi rzwirtz,
Thank you for posting in the community.
I wasn’t able to replicate the behavior you are describing. Please check the sample I created. In order to investigate this issue further, I will need to take a look at your code or a sample project, demonstrating this behavior.
Please feel free to contact me if you have any questions.
I was able to fix the issue. What happened was I created custom control in the appcode named "NodeWebDataTree" that inherited from the infragistics web data tree. This control was bound to a collection of my own Node objects(Which are entirely different than infragistics node objects). In the init of this control I was loading up a set of nodes from a database and setting it as the data source. What I figured out is that if you set the datasource and databind in the init event it only works during the first load. If I move the setting of the datasource to the DataBinding event it on subsequent post backs.
Hello rzwirtz,
I'm glad I could help. If you have any further questions please do not hesitate to ask.
That worked perfect. Thanks for the help.
I suggest that you try using WebDataTree’s manual load on demand to dynamically create nodes, depending on the object type you bind them to. Demonstrative sample of this feature can be found here - http://samples.infragistics.com/aspnet/Samples/WebDataTree/Performance/ManualLoadOnDemand/Default.aspx?cn=data-tree&sid=c257cd9c-1c5a-4159-aa51-ff8ea8386395.
If you have any other questions please feel free to contact me.
That works, however the node being bound at all is causing a performance issue. The way my object is written it does not load the collection of objects unless it you ask for them. Because of that doing any loading at all put performance strain on my application. The collection is a collection of documents associated with the web page object. They can be quite large, so loading them from the database when I don't even need to display them is somewhat silly. Is there any way to only have the tree bind objects of a certain type?
I have been reading through your post and I can suggest that you check the DataMember property of each node in NodeBound event handler. If it is different from your page object’s class, you could set it’s Visible property to false.
protected void WebDataTree1_NodeBound(object sender, DataTreeNodeEventArgs e)
{
object dataItem;
dataItem = e.Node.DataItem;
if ( dataItem.GetType().ToString() != "MyPage")
e.Node.Visible = false;
//Shows the node's parent as empty
e.Node.ParentNode.IsEmptyParent = false;
}
Please let me know if this helps.