I have a tree that can't refresh the page when loading data. So I went with ManualSmartCallbacks. It works perfectly. However, when I do a postback I can't get any of the information about the nodes. I tried AutomaticSmartCallbacks as well. This article explains that it is impossible to get the nodes on the server side
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=9685
It says
The limitations of ManualSmartCallbacks may render it unsuitable for use in situations where the full page must be posted back to the server and the full state of all expanded nodes needs to be recreated by the application. In such cases, the preexisting value of Manual should continue to be used. With LoadOnDemand.Manual set and ViewState enabled, the WebTree is able to reconstruct the node structure on a full postback of the page.If you are using NetAdvantage for .NET 2006 Volume 3 or later, you can still achieve AJAX functionality without incurring the limitations of ManualSmartCallbacks. Place your WebTree inside a WebAsyncRefreshPanel (or "WARP"), and set the LoadOnDemand property to Manual instead. This gives the flexibility of Manual load-on-demand, including the persisting of the tree's node structure, while providing AJAX functionality via the WARP.
So, how do I get the Ajax functionality while still being able to get the nodes on postback? The articles says "Place your WebTree inside a WebAsyncRefreshPanel (or "WARP"), and set the LoadOnDemand property to Manual instead." But, this doesn't work at all. It only populates the first nodes, then when expand is pressed, those nodes dissapear. All I did was add the WebAsyncRefreshPanel and set the LoadOnDemand property of the tree to "Manual". So how do I get this to work?
The only alternative I can think of is to collect all the nodes on the client side and then send them across to the server using Ajax (webmethod). This is really nasty and the control should do this work for me.
stafford said:Simplified: The code below will only work to the 1st child of root if UltraWebTree.LoadOnDemand=ManualSmartCallbacks.
To expand upon this a little: If you can encode enough information in the original node's DataPath property to be able to determine or recreate what "e.Node.Text" is in the previous post, and if you set the new nodes DataPath property in a similar fashion (remember that a DataPath should be unique), then ManualSmartCallbacks can accomplish this task.
Thanks so much for this article. There are alot of topics that are related to this problem, however it would seem this is the only one that actually spells out the answer :)
Simplified: The code below will only work to the 1st child of root if UltraWebTree.LoadOnDemand=ManualSmartCallbacks. To get the code to work as expected, enclose the UltraWebTree in a WebAsyncRefreshPanel and set UltraWebTree.LoadOnDemand=Manual. Voila!
Thanks again for this post.
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Node n = new Node(); n.Text = "Root"; n.ShowExpand = true; UltraWebTree1.Nodes.Add(n); } } protected void UltraWebTree1_DemandLoad(object sender, Infragistics.WebUI.UltraWebNavigator.WebTreeNodeEventArgs e) { Node n = new Node(); n.Text = e.Node.Text; n.ShowExpand = true; e.Node.Nodes.Add(n); }
Yes, that's true. I noticed a reduction in speed when I switched to using the WARP. But, I didn't have a choice really.
I strongly recommend that Infragistics look at implementing web service calls as part of the Ajax control experience. It gets around all the problems with partially posting back etc.
Thanks for posting your code, as this may help someone else with a similar setup.
You're correct in supposing that a WARP is very similar to the UpdatePanel from the ASP.NET AJAX Extensions toolset.
I can also comment on the "why" both Manual+WARP and ManualSmartCallbacks exist - because ManualSmartCallbacks was introduced before WARP and UpdatePanel were created. The other benefit to using ManualSmartCallbacks is that it passes less data from the client to the server and back, which may have improve the performance of your website slightly.
Thanks yes you are right.
Actually I read another article and found that what I had to do was set the tree to manual and place the tree inside a WebAsyncRefreshPanel (as you said WARP) which I'm guessing is like an ASP UpdatePanel. Here is the code.
Funny that the samples don't show how this is done.
I can't really understand why you would use the other methods of populating the tree because in the two Ajax modes, only the DataPath property is persisted to the server side. With WebAsyncRefreshPanel, all the Nodes and their properties are persisted to the server side.
My advice is to use the WARP and not the other modes that the samples use; unless, you only want to do processing on the client side. But, I can't really imagine a case where you would only want to work on the client side. Would I be right in saying that ManualSmartCallbacks are only maintained because people have used them in the past?
<igmisc:WebAsyncRefreshPanel runat="server" ID="treeAsyncPanel" LinkedRefreshControlID="AccessTreeView"
Width="470px" Height="465px">
<ignav:UltraWebTree ID="AccessTreeView" runat="server" Cursor="Default" ForeColor="Black"
ExpandAnimation="AccelDecel" Font-Size="8pt" Font-Names="Verdana" BorderColor="Black"
BorderStyle="Solid" Height="460px" Width="470px" Indentation="20" WebTreeTarget="HierarchicalTree"
LoadOnDemand="Manual" CompactRendering="False" EnableViewState="True" SingleBranchExpand="false"
OnDemandLoad="AccessTreeView_DemandLoad" >
<SelectedNodeStyle Cursor="Hand" CssClass="SelectClass"></SelectedNodeStyle>
<HoverNodeStyle Cursor="Hand" CssClass="Hover"></HoverNodeStyle>
<NodePaddings Left="5px"></NodePaddings>
<Padding Bottom="2px" Left="2px" Top="2px" Right="2px"></Padding>
<NodeMargins Top="2px"></NodeMargins>
<Styles>
<ignav:Style Cursor="Hand" ForeColor="Black" BackColor="OldLace" CssClass="HiliteClass">
</ignav:Style>
<ignav:Style BorderWidth="1px" BorderColor="DarkGray" BorderStyle="Solid" BackColor="Gainsboro"
CssClass="Hover">
<ignav:Style ForeColor="White" BackColor="#333333" CssClass="SelectClass">
</Styles>
</ignav:UltraWebTree>
</igmisc:WebAsyncRefreshPanel>