CodeVerge.Net Beta


   Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: Date Entered: 7/6/2005 7:33:15 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 1 Views: 36 Favorited: 0 Favorite
2 Items, 1 Pages 1 |< << Go >> >|
"MorningZ" <>
NewsGroup User
Menu + Roles + Different based on QueryString value7/6/2005 7:33:15 PM

0

Ok, in my Web.sitemap file i have

<siteMapNode url="" title="Users" description="Manage User" roles="Admin,SiteUser">
             <
siteMapNode url="~/users/profile.aspx" title="My Profile" description="Manage your site profile" roles="SiteUser" />
            ..... other items
             <
siteMapNode url="~/users/profile.aspx?Mode=Add" title="Add User" description="Add a brand new user" roles="Admin" />
</siteMapNode>


So as you can see the only difference between the two is the "Mode=Add"

how can i get the menu to ignore showing the "Add User" link for non-Admins?  or am i going to have to manually remove it during menu rendering?


"If you make it idiot proof, they'll build a better idiot"
"Dave Sussman"
NewsGroup User
Re: Menu + Roles + Different based on QueryString value7/7/2005 8:19:43 AM

0

The Roles attribute on this node has no effect here; when used on SiteMapNode elements the roles attribute only widens the visibility of a node. To restrict it you mist use the authorization section(s) in web.config. However you cannot have query string parameters for the path of  alocation tag.

The best way to handle this is to use the data binding event, where you can check the node for a custom attribute and if the attribute is present and the user is not in the admin role remove it. Custom attributes are described in an excellent blog post by Danny Chen: http://weblogs.asp.net/dannychen/archive/2005/03/28/396099.aspx. The code to delete a node could be:

Protected Sub MyMenu_MenuItemDataBound(ByVal sender As Object, _
                                       ByVal e As System.Web.UI.WebControls.MenuEventArgs)

    Dim text As String = e.Item.Text

    If CType(e.Item.DataItem, SiteMapNode)("adminOnly") AndAlso Not User.IsInRole("Admin") Then
        e.Item.Parent.ChildItems.Remove(e.Item)
    End If

End Sub

Dave

2 Items, 1 Pages 1 |< << Go >> >|


Free Download:













help : user master page with asp:formparameter , save only blank data to database msaccess

reportviewer control inside the contentplaceholder - not showing up

menu item selection open

print preview of a page different from what it comes out after printing...... css issue

using button click event handler in contentplaceholder - button not a member of the webpage??

masterpage is not up to date

treeview

expand treeview onmouseover

sitemap and menu control

treeview with a collection of custom treeviewnodes

master page

problem in master pages in vs 2008

master page and content refresh

is this a know bug with the asp:menu control?

masterpage problem.image in masterpage not shows in childpages

adding child node to selected node

wizard control onfinishbuttonclick

css rule isn't recognized in my theme folder

extender and skin...

masterpage spacing

treeview newbie question

accessing a linqdatacontrol from a content page (master pages)?

accessing an unordered list

problem using master page in subfolders

reload a masterpage from code

menu control being affected by style sheet ..

problem with a master page

meta tag closing "/" gets removed when asp.net page is rendered.

'asp._masterpage_master' does not contain a definition for 'topmenurepeater_itemcommand'

site map error

easy question

reload contenplaceholder in my masterpage

multiple web.sitemap files?

update a treeview on a page

convert webpage to an image?

menu

access2000 as sitemapdatasource

master pages and css layout problem

finding control on masterpage

using 1 master page in 2 different projects

voice of asp net 2.0 menu completely clickable

callback not happening from a content page.

master page coding

where is preinit event?

multiple codebehind files of master/aspx/ascx-files inherit from custom base-class

showing loggin status in menu control

using master pages in web application projects

how to keep state of master page across multiple pages?

treeview selection without postback solved....

asp:menu items with images - skin code required please!

   
  Privacy | Contact Us
All Times Are GMT