No, no usercontrols in the treeview. Here is an extract from my code...maybe
you can see what is happening, I've been staring at it for too long:
TREEVIEW PLACED IN A TABLE CELL ON THE MASTER PAGE:
<asp:TreeView ID="tvMenu" runat="server" DataSourceID="Menu"
ShowExpandCollapse="False" NodeIndent="8">
<ParentNodeStyle Font-Bold="True" />
<HoverNodeStyle Font-Italic="True" />
<RootNodeStyle Font-Bold="True" />
<NodeStyle ForeColor="Firebrick" HorizontalPadding="3px" />
<DataBindings>
<asp:TreeNodeBinding DataMember="PACS" SelectAction="None" />
<asp:TreeNodeBinding DataMember="ANode"
ImageUrl="~/Public/bullet-red.gif" SelectAction="None" TextField="Name"
ValueField="Permit" />
<asp:TreeNodeBinding DataMember="BNode"
ImageUrl="~/Public/bullet-red.gif" SelectAction="None" TextField="Name"
ValueField="Permit" />
<asp:TreeNodeBinding DataMember="CNode"
ImageUrl="~/Public/bullet-narrow-red.gif" TextField="Name"
ValueField="Permit" TargetField="Target" />
</DataBindings>
</asp:TreeView>
<asp:XmlDataSource ID="Menu" runat="server"
DataFile="~/Menu.xml"></asp:XmlDataSource>
CODE-BEHIND FILE FOR MASTER PAGE:
Partial Class PACSMasterPage
Inherits System.Web.UI.MasterPage
Private appsess As PACS.AppSession
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
appsess = New PACS.AppSession(Session)
End Sub
Protected Sub tvMenu_DataBound(ByVal sender As Object, ByVal e As
System.EventArgs) Handles tvMenu.DataBound
tvMenu_Traverse(tvMenu.Nodes(0))
End Sub
Protected Sub tvMenu_Traverse(ByVal node As TreeNode)
For Each n As TreeNode In node.ChildNodes
If n.ChildNodes.Count > 0 Then
tvMenu_Traverse(n)
If n.Value <> "ALL" Then
If Not Validate_User(n.Value, appsess.USER_ACCESS_CSV)
Then
n.Collapse()
End If
End If
End If
Next
End Sub
Protected Function Validate_User(ByVal permit As String, ByVal access As
String) As Boolean
For Each a As String In Split(access, ",")
For Each p As String In Split(permit, ",")
If p = "ALL" Then Return True
If a = p Then Return True
Next
Next
Return False
End Function
Protected Sub lnkLogOff_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles lnkLogOff.Click
Dim j As Common.JavaScript = New Common.JavaScript()
j.WindowClose()
j.Send(MyBase.Page)
End Sub
Protected Sub tvMenu_SelectedNodeChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles tvMenu.SelectedNodeChanged
If Validate_User(tvMenu.SelectedNode.Value, appsess.USER_ACCESS_CSV)
Then
If tvMenu.SelectedNode.Target <> String.Empty Then
Response.Redirect(tvMenu.SelectedNode.Target)
End If
End Sub
End Class
XML FILE FOR TREEVIEW DATASOURCE
<?xml version="1.0" standalone="yes"?>
<PACS Name="PACS Menu" Permit="ALL">
<ANode Name="Data Interface" Permit="ALL">
<BNode Name="Data Logger" Permit="ALL">
<CNode Name="New Entry" Permit="ALL"
Target="/PACS/App_Forms/DataInt/DataLogger_new.aspx" />
<CNode Name="Edit Existing Entry" Permit="ALL"
Target="/PACS/App_Forms/DataInt/DataLogger_select.aspx" />
</BNode>
<CNode Name="Log Inspection Results" Permit="ALL" Target="" />
<CNode Name="View Inspection Results" Permit="ALL" Target="" />
</ANode>
<ANode Name="Reports" Permit="ALL">
<BNode Name="PACS Standard Reports" Permit="ALL">
<CNode Name="Assembly Defect Summary" Permit="ALL"
Target="/PACS/App_Forms/Rpts/reports.aspx?type=100" />
<CNode Name="Traceability" Permit="ALL"
Target="/PACS/App_Forms/Rpts/reports.aspx?type=900" />
<CNode Name="Data Screening" Permit="ALL"
Target="/PACS/App_Forms/Rpts/reports.aspx?type=910" />
<CNode Name="Data Screening Detail" Permit="ALL"
Target="/PACS/App_Forms/Rpts/reports.aspx?type=920" />
<CNode Name="Part Project Detail" Permit="ALL"
Target="/PACS/App_Forms/Rpts/reports.aspx?type=930" />
</BNode>
</ANode>
<ANode Name="Maintenance Functions" Permit="ALL">
<CNode Name="Parts / Assemblies" Permit="ALL"
Target="/PACS/App_Forms/Maint/products.aspx" />
<CNode Name="Projects" Permit="ALL" Target="" />
<CNode Name="Attribute Groups" Permit="ALL"
Target="/PACS/App_Forms/Maint/Quality.aspx" />
<CNode Name="Defect Rate Groups" Permit="ALL" Target="" />
</ANode>
<ANode Name="Administration" Permit="ADMIN">
<BNode Name="Maintain Users" Permit="ADMIN">
<CNode Name="Create New User" Permit="ADMIN"
Target="/PACS/App_Forms/Admin/user_new.aspx" />
<CNode Name="Update Existing User" Permit="ADMIN"
Target="/PACS/App_Forms/Admin/user_update.aspx" />
</BNode>
<CNode Name="Purge Test Data" Permit="ALL" Target="" />
<CNode Name="Purge Unit Test Data" Permit="ALL" Target="" />
<CNode Name="Shift Times" Permit="ALL" Target="" />
</ANode>
</PACS>