Hi,
I tried it in the load and databound of the form and the treeview, as well as the treenodepopulate. A couple other places as well. In all cases the treeview was either empty or had only one node.
HOWEVER, I seem to have solved the issue. I created a custom sitemap provider. It was pretty simple. And as part of the custom provider, I added the ability to pass the user object in and it will build the sitemap based on the user's roles.
Since I've got this working I'm going to go with it.
Thanks for your help!
Paul
Code:0 Public Class SiteMapProv Inherits StaticSiteMapProvider Private _root As SiteMapNode Private _adminNode As SiteMapNode Private _usr As User Private _userLoadTS As DateTime Protected Overrides Function GetRootNodeCore() As System.Web.SiteMapNode Return _root End Function Public Overrides Function BuildSiteMap() As System.Web.SiteMapNode SyncLock Me 'If the user object has been reloaded, or if it's a different user, then reload the sitemap. If _userLoadTS = _usr.loadTS Then Return _root End If Me.Clear() _userLoadTS = _usr.loadTS 'Create a root node _root = New SiteMapNode(Me, Pages.HOME_PAGE, "Home.aspx", "Application Home") AddNode(_root) If _usr.isAuthorized Then AddNode(New SiteMapNode(Me, Pages.BILL_CODE_MAINT, "BillCodeMaintenance.aspx", "Bill Code Maintenance"), _root) AddNode(New SiteMapNode(Me, Pages.GRP_TYP_MAINT, "GroupTypeMaintenance.aspx", "Group Type Maintenance"), _root) AddNode(New SiteMapNode(Me, Pages.GRP_UPDT, "GroupSearchUpdate.aspx", "Group Search Update"), _root) AddNode(New SiteMapNode(Me, Pages.MASTER_GRP_SEARCH, "MasterGroupSearch.aspx", "Master Group Search"), _root) If _usr.isInRole(Role.ADMIN) Then _adminNode = New SiteMapNode(Me, "Admin", "", "Admin") AddNode(_adminNode, _root) AddNode(New SiteMapNode(Me, Pages.ADD_USER, "Admin/AddUser.aspx", "Add User"), _adminNode) AddNode(New SiteMapNode(Me, Pages.MOD_USER, "Admin/ModifyUser.aspx", "Modify User"), _adminNode) End If End If Return _root End SyncLock End Function Public Property user() As User Get Return _usr End Get Set(ByVal value As User) _usr = value End Set End Property End Class




Reply With Quote
