473,385 Members | 1,555 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

MenuitemDataBound With roles

Hi everyone

I am using a mainmenu witeh sitemap provider
with folowing sitemap
<siteMapNode>
<siteMapNode url="" title="Master Data" description="Enter Master data" roles ="Admin,PM">
<siteMapNode url="~/PL/Master/ViewProjects.aspx" title="Projects" description="View/Add Projects" roles ="Admin,PM" />
<siteMapNode url="~/PL/Master/AssignProject.aspx" title="Assign Project" description="Enter User Details details" roles ="Admin,PM" />
<siteMapNode url="~/PL/Master/Addtask.aspx" title="Tasks" description="New Task" roles ="Admin,PM"/>
<siteMapNode url="~/PL/Master/AssignTask.aspx" title="Project Tasks" description="Assign Task to Projects" roles ="Admin,PM" />
<siteMapNode url="~/PL/Master/ClientDetails.aspx" title="Clients" description="View/Add clients" roles ="Admin,PM" />
<siteMapNode url="~/PL/Master/Createuser.aspx" title="Create New User" description="Create New User" roles ="Admin,PM"/>
<siteMapNode url="~/PL/Master/EmployeeDetails.aspx" title="Employees" description="Employee Details" roles ="Admin,PM"/>
</siteMapNode>

<siteMapNode url="" title="Timesheet" description="Enter timesheets" roles ="Admin,PM,Emp">
<siteMapNode url="~/PL/Timesheet/Timesheet.aspx" title="Timesheet" description="Billing Description" roles ="Admin,PM,Emp" />
</siteMapNode>

<siteMapNode url="" title="Reports" description="Generate Reports" roles ="Admin,PM,Emp">
<siteMapNode url="~/PL/Timesheet/ViewTimeDetails.aspx" title="View Time Report" description="ViewTimeDetails" roles ="Admin" />
<siteMapNode url="~/PL/Timesheet/ReportProject.aspx" title="Project Report" description="ViewTimeDetails" roles ="Admin" />
<!--<siteMapNode url="PL/Reports/EmplDate.aspx" title="Employee Date Report" description="Employee totals" roles ="Admin" />
<siteMapNode url="~/PL/Reports/EmplReport.aspx" title="Employee Project Report" description="Employee Report" roles ="Admin" />
<siteMapNode url="~/PL/Reports/ProjectReport.aspx" title="Project Report" description="Client Project Report" roles ="Admin" />-->
</siteMapNode>

on the basis of roles i want to hide some nodes reports sections for differnt user

Following code is binding menu
protected void MainMenu_MenuItemDataBound(object sender, MenuEventArgs e)
{
System.Web.UI.WebControls.Menu menu = (System.Web.UI.WebControls.Menu)sender;
SiteMapNode mapNode = (SiteMapNode)e.Item.DataItem;

if(! mapNode.Roles.Contains( Session["Roles"].ToString()))
//if ( Session["Roles"].ToString()!=mapNode.Roles[0].ToString())
{
System.Web.UI.WebControls.MenuItem itemToRemove = menu.FindItem(mapNode.Title);

if (itemToRemove != null)
{
menu.Items.Remove(menu.FindItem(mapNode.Title));
}

}

}

Please telll me how to bind for submenus?according to roles describe
Apr 3 '07 #1
0 2668

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Mad Scientist Jr | last post by:
I would like to write a vb.asp.net function Private Function fn_sGetRoles(byval sDelimiter as string) As String that simply returns a delimited list of all the roles a user belongs to. I...
5
by: hansiman | last post by:
Following http://aspnet.4guysfromrolla.com/articles/082703-1.aspx I've set up roles authentication for my web application. User's roles are registered by: HttpContext.Current.User = _ New...
7
by: Matthias S. | last post by:
Hi, here is what I'm trying to do: I have a virtual directory called "WebApp". Under this one I've got 2 physical directories called "Customers" and "Admins". I implemented Forms-based...
1
by: chris.rust | last post by:
Has anyone else had any trouble setting up a sitemap view to be filtered by roles? We've put a cust role provider in place, and we can verify that it's only being called once for each...
9
by: Mike Hofer | last post by:
BACKGROUND: We've designed a Website for a client that will be deployed across multiple physical locations. The site will be hosted from a corporate NOC, and administered by the IT group there. ...
1
by: jesibl | last post by:
Hi All, I have an ASP .NET 2.0 web based app which should change content based on a variable passed in the query string. Let's say the variable is called ID and the variations are A, B and C. ...
0
by: Douglas J. Badin | last post by:
Hi, The problem with Authorization is it stops at the first match and doesn't permit Grouping. On the Web Site, I am trying to Secure Page Access and SiteNaviagation by implementing the...
4
by: AC | last post by:
Hi there. My asp.net 2.0 development website uses roles to control access to sections of my site, configured using the asp.net configuration tool, which is great. Except that isn't available once...
2
by: Nathan Sokalski | last post by:
When I call System.Web.Security.Roles.GetRolesForUser() it returns no results (an array of length 0) even though I have roles associated with the currently logged in user. I am able to get the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.