skmMenu 2.2 Released

Published 22 February 04 02:49 PM | Scott Mitchell

Over the weekend I released the latest version of skmMenu, Version 2.2. (skmMenu is a free, open-source custom ASP.NET control that displays client-side menus.) skmMenu 2.2 fixed a couple of bugs, and added a number of new features. The coolest feature to be added, in my opinion, is the concept of roles. There are many cases where the menu items to display depend on the current user viewing the Web page. For example, if the logged in user is an administrator, they may be able to see more menu options than a non-authenticated user, or a user with less access. Previous to version 2.2, to accomodate such functionality you'd have to programmatically build up the menu based on the current user's access rights. So, those who needed the menu generated based on a user's rights were unable to use the simpler approach of just binding the menu to an appropriately structured XML file.

With Version 2.2, a developer can now assign any number of roles to any menu item in the XML markup. For example, imagine you wanted a menu item that was only visible to admins and managers. You could use XML like:

<menu>
<menuItem>
<text>Only Accessible to Admins/Managers</text>
<roles>admin,manager</roles>
...
</menuItem>
...
</menu>

When binding the XML to skmMenu, you can specify what roles the current user belongs to. For example, say the current user belonged to admins role, you could use:

Menu1.UserRoles.Add(”admin”)
Menu1.DataSource = path to XML file
Menu1.DataBind()

And, for this user, they'd see the “Only Accessible to Admins/Managers” menu item. However, if someone wasn't in the admin or manager roles, they would not see the menu item. These menu item roles can be appplied at any level of granularity: as a top-level menu item, or a menu item in a submenu or a submenu of a submenu, and so on.

You can see a live demo illustrating the functionality of roles at http://skmmenu.com/menu/Examples/Roles.aspx.

Eventually, I'd like to have it so that skmMenu ships with a GUI tool for creating the menu item XML file - right now you have to enter it by hand, referring to the XML schema and hope you don't make a typo or mess up on the casing of the tag names...

For more information on skmMenu, or to download the complete source code, visit skmMenu.com...

Filed under:

Comments

No Comments

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Archives

My Books

  • Teach Yourself ASP.NET 4 in 24 Hours
  • Teach Yourself ASP.NET 3.5 in 24 Hours
  • Teach Yourself ASP.NET 2.0 in 24 Hours
  • ASP.NET Data Web Controls Kick Start
  • ASP.NET: Tips, Tutorials, and Code
  • Designing Active Server Pages
  • Teach Yourself Active Server Pages 3.0 in 21 Days

I am a Microsoft MVP for ASP.NET.

I am an ASPInsider.