Welcome Guest Search | Active Topics | Sign In | Register

TreeView - Show/Hide based on user Options
Becky
Posted: Thursday, February 26, 2009 4:55:23 PM
Rank: Newbie
Groups: Member

Joined: 2/26/2009
Posts: 1
I need to show one particular treenode based on the type of user viewing the page. I have this working with the code below but I don't want to use indexes since they will change when I insert a new node in the tree. How can I work around this?

if (HttpContext.Current.User.IsInRole("Financial"))
{
EO.Web.TreeNode node = tv_ReportsTree.TopGroup.Nodes[2].ChildNodes[6];
node.Visible = true;
}
eo_support
Posted: Thursday, February 26, 2009 4:59:13 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You don't need to do that. All you need to do is to set the TreeNode's AllowRoles property:

http://doc.essentialobjects.com/library/1/eo.web.navigationitem.allowroles.aspx

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.