This is my ASP code. I just took it from a sample:
<ignav:UltraWebTree ID="AccessTreeView" runat="server" Cursor="Default" ForeColor="Black"
Font-Size="8pt" Font-Names="Verdana" BorderColor="Pink" BorderStyle="Dashed" Height="400px"
Width="300px" Indentation="20" WebTreeTarget="ClassicTree" LoadOnDemand="Manual"
CompactRendering="False" EnableViewState="False" SingleBranchExpand="True" 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>
<Levels>
<ignav:Level Index="0"></ignav:Level>
<ignav:Level Index="1"></ignav:Level>
</Levels>
<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>
This is my Page_Load code:
var AccessControlPopup = (PopupControl)RecordFormView.FindControl("AccessControlPopup");
AccessTreeView.Visible = true;
{
accessGroupNode.DataKey = accessGroup.AccessGroupKey.ToString();
}
AccessTreeView.DataBind();
AccessTreeView.ExpandAll();
When I step through the code, I clearly see that 1 node is being added to the collection AccessTreeView.Nodes. However, when the tree view is displayed, it is completely empty.
This is my DemandLoad code, however it is not being hit so I think it is irrelevent:
childAccessGroupNode.DataKey = childAccessGroup.AccessGroupKey.ToString();
Hello,
I think the problem here is calling AccessTreeView.DataBind() immediately after adding the node. The treeview supports bound and unbound modes - adding nodes directly to the controls collection is unbound mode, while calling DataBind() is bound mode and expects setting DataSource or DataSourceID properties. Calling DataBind() with empty DataSource/DataSourceID essentially clears the nodes.
I think if you are adding nodes directly to the nodes collection, you do not need to call DataBind() so removing the line should hopefully address the problem.
Thanks. I tried commenting that line out but it makes not difference.