Scott on Writing

Musings on technical writing...

skmMenu 2.2 Released

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...

posted on Sunday, February 22, 2004 2:49 PM

Feedback

# re: skmMenu 2.2 Released 2/22/2004 11:41 PM Mike Singer

Excellent job, Scott.

The next step would be to get all the MS Starter Kits
menu functionality into your skmMenu.
I wonder, how would respected Linux folks criticize
the kinda open source?

Mike.

# re: skmMenu 2.2 Released 2/23/2004 11:59 AM mikko

Just wanted to give you an atta-boy. This menu just keeps getting better and better.

# re: skmMenu 2.2 Released 2/24/2004 6:02 AM Jonx

What I have done for my own menu control, is adding an OnMenuItemAdd event... that's the way I used to costumize the items that should be displayed or not...

# re: skmMenu 2.2 Released 2/25/2004 2:57 AM Mischa

This Menu rocks !!!

Keep up the good work :)

# re: skmMenu 2.2 Released 3/18/2004 12:11 PM Walt Lounsbery

Great! The earlier version of the menu has worked very well, and I'm anxious to work with the newest version with role support. As you say, it is possible to do all that in code, which I did with four roles and a fairly simple menu structure. In my case, some people get multiple roles out of the basic four, and a drop-down out of the menu allows them to select their menu view. My rather unlearned users have picked that up well.

Thanks for the great work.

# re: skmMenu 2.2 Released 9/10/2004 11:53 PM rockhead

Great menu. I have a question. How could I highlight the current menu item. E.g. there are 3 menu item, "home","menu1","menu2". Suppose I am on menu1 page, how could I make the menu highlighted on menu1?

thanks and again, you did a great job.

# re: skmMenu 2.2 Released 9/16/2004 2:51 AM Pertus Sébastien

Hi

I m Sébastien Pertus, Developer in ASP.Net
I m frensch, so excuse me for my poor english :)

I have a problem with SKmMenu.
I have a Menu with sub items. My Menu contains items from a database (not an xml file)
The layout is Vertical

I have a problem with rollover mouse.
When a subitems desapears, a part of the menu desapears too ... I dont know why ?
You can see it here : http://cmw.esquif.net/Minotaure/default.aspx

i go to menu named "Gallerie" or "Les Listes" or "Liens". after i go to a sub menu ("Gallerie" -> "TOA" for example) I DONT CLICK on the submenu, when the sub menu desappears, a part of the root menu desappears too ... I dont know why ?

In my code, i just do this (summary):

Dim myurl, mytexturl As String
Dim myMenuItem As skmMenu.MenuItem
Dim mySubMenuItem As skmMenu.MenuItem

Menu1.Items.Clear()
Menu1.Layout = skmMenu.MenuLayout.Vertical
Menu1.HighlightTopMenu = False
' I tryed Menu1.HighlightTopMenu = true. Result is same
Menu1.Opacity = 75
Menu1.zIndex = 100
Menu1.Cursor = skmMenu.MouseCursor.Pointer


For Each dr In dtab.Rows

myurl = dr.Item("CAT_url")
mytexturl = dr.Item("CAT_titre")

myMenuItem = New skmMenu.MenuItem(mytexturl, myurl)

If Not CType(dr.Item("CAT_parentID"), Int32) = -1 Then
mydv = New DataView(dtab, "CAT_parentID = " & dr.Item("PK_CAT_id"), "CAT_order asc", DataViewRowState.CurrentRows)

For Each o In mydv
myurl = dr.Item("CAT_url")
mytexturl = o.Item("CAT_titre")
mySubMenuItem = New skmMenu.MenuItem(mytexturl, myurl)
myMenuItem.SubItems.Add(mySubMenuItem)

Next
End If

Menu1.Items.Add(myMenuItem)


End If
End If
Next


Dunno what to do :)

thanks for your answer :)

Sébastien Pertus

# Help with User Role Menu 9/27/2004 3:04 AM Patrick

Hi Scott,
I would like to use the User Role Menu.
I have looked through ur example but what i want to do is populate a menu in XML depending on the user that logged in on the system.
Can you give me more ideas on how to do this.
Thanks alot
ige@email.com

# re: skmMenu 2.2 Released 10/27/2004 8:13 PM JB

I suggest you don't get TOO excited about this release just yet.

If Smart Nav is ON, it CRASHES IE. See the workspaces bugs list.

# re: skmMenu 2.2 Released 11/3/2004 2:23 AM BMaher

Hi,
After binding the skmMenu control, is it possible to add in another menu item through code ?
I tried this and it didn't work

Menu1.DataBind()
Dim mnuHelp As New skmMenu.MenuItem("Help")
Menu1.Items.Add(mnuHelp)

Any suggestions ?

# Dynamic Menu 12/17/2004 7:07 PM Venkatesh Natarajan

How do i specify user roles when dynamically generating menus ? In this case i am not using XML, i am using data from database and dynamically building the menu items.

Please do let me know

# Dynamic Menu 12/17/2004 9:18 PM Venkatesh Natarajan

How do you add role to the submenu item ?

Dim submenu1 As New skmMenu.MenuItem("<img src=""menublip.gif"" align=""absmiddle"">Dynamic Item 1", "")
submenu1.SubItems.Add(New skmMenu.MenuItem("Sub Item 1", "page1.html"))
submenu1.SubItems.Add(New skmMenu.MenuItem("Sub Item 2", "page2.html"))
submenu1.Roles.Add("Manager")

in the above code, the last line adds role to the submenu1. However i want to add role to the "sub item 1". How can i do this ?

Any suggestions ?

# re: skmMenu 2.2 Released 2/16/2005 8:02 AM Dejan Lukic

Hi,
I will use your skmMenu control in the application that I work on at this time. Thing is the control does not support '~/' application root or navigation (back and forth) to the directory within app.
e.g.
<menuItem>
<image>images/btn_pmt.gif</image> <mouseoverimage>images/btn_pmt_over.gif</mouseoverimage>
<url>DLtest/</url>
</menuItem>

When I use same menu from the DLtest.aspx application crashes.
Any suggestions? What can I do?
Thanks

# re: skmMenu 2.2 Released 9/13/2005 12:14 PM Maha

Hi, I am thrilled to learn skmMenu and its powerful and yet simpler way to give control on menu structure.
However, for some reason, I dont see the menu at all when I browse under IE 6.0 !
I dont understand where the problem is. I use the newest Visual Studio 2005.

I appreciate your great work; Thanks in advance for your reply.

# re: skmMenu 2.2 Released 11/9/2005 10:02 AM Travis Baseflug

Can anyone email me example of pulling from db (SQL) - perf. in c# to: Tbaseflug@msn.com

# re: skmMenu 2.2 Released 11/22/2005 2:49 PM Dev

Scott...

First of all, thanks for developing this control... Its cool!!!

I have a small issue when implementing the control. I'm using this as a Vertical Menu control, where the Menu items gets hidden behind an HTML Table (just below the control)with images/.NET controls like dropdown lists. Is there a way for me to not hide the menu item??

Thanks
Dev

# re: skmMenu 2.2 Released 1/5/2006 1:32 PM Mohamed Aourik

After I added the menu control to my tool box i cannot drag and drop it on any of my forms. I am doing something wrong? or is there a setup some where i need todo. Please help as i really want to use this greate menu.

Thanks

# re: skmMenu 2.2 Released 1/3/2007 9:56 AM JC

I've posted a bunch of questions about the skmmenu on the workspace but they never get answered...is their anybody out there supporting this control?

THank you.
Jon

# re: skmMenu 2.2 Released 3/2/2008 7:47 AM Wouter Spelt

Hi,

@Pertus Sébastien

Use position:absolute; in your menustyle:

like:
.menustyle
{
background-color:white;border:1px;border-style:solid;border-color:Gray;
position:absolute;
}

This will fix the vertical layout problem.
I ran into the same.

Wouter

# Vertical layout problem 3/2/2008 11:22 AM Wouter Spelt

Instead of position:absolute
try not to use the Opacity property on the menu.

This works better.
Cheers

Title:  
Name:  
Url:
Protected by Clearscreen.SharpHIPEnter the code you see:
Comments   

Add To Your Reader

My Links

Archives

Post Categories

 

I am a Microsoft MVP for ASP.NET.
I am an ASPInsider.
<May 2008>
SMTWTFS
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

Comment Stats

DayTotal% of Total
Sunday 1866.8%
Monday 37913.9%
Tuesday 45316.7%
Wednesday 50418.5%
Thursday 53519.7%
Friday 49418.2%
Saturday 1666.1%
Total 2717100.0%

Hour1Total% of Total
12:00 AM 652.4%
1:00 AM 682.5%
2:00 AM 622.3%
3:00 AM 742.7%
4:00 AM 572.1%
5:00 AM 1033.8%
6:00 AM 1084.0%
7:00 AM 1585.8%
8:00 AM 1716.3%
9:00 AM 1475.4%
10:00 AM 1716.3%
11:00 AM 1816.7%
12:00 PM 1886.9%
1:00 PM 1696.2%
2:00 PM 1605.9%
3:00 PM 1324.9%
4:00 PM 1073.9%
5:00 PM 923.4%
6:00 PM 913.3%
7:00 PM 963.5%
8:00 PM 833.1%
9:00 PM 782.9%
10:00 PM 792.9%
11:00 PM 772.8%
Total 2717100.0%

Comments by Blog Entry Date/Time

Day Entry MadeAvg.Total
Sunday 5.54144
Monday 5.22339
Tuesday 4.28419
Wednesday 7.67637
Thursday 6.90607
Friday 5.48411
Saturday 5.33160
Total 5.842717

Hour1 Entry MadeAvg.Total
12:00 AM 5.0035
1:00 AM 1.002
5:00 AM 0.000
7:00 AM 7.0035
8:00 AM 5.35107
9:00 AM 6.32278
10:00 AM 6.47246
11:00 AM 4.41181
12:00 PM 6.88330
1:00 PM 3.00111
2:00 PM 5.41222
3:00 PM 8.64285
4:00 PM 4.0589
5:00 PM 5.92154
6:00 PM 4.52113
7:00 PM 9.67174
8:00 PM 9.80147
9:00 PM 5.05111
10:00 PM 5.4265
11:00 PM 4.5732
Total 5.842717

Learn More About Comment Stats
1 - All times GMT -8...


Blog Stats

Favorite Web Sites

My Books

My MSDN Articles