Paul Andrew requested me to update a advanced example of asp doi menu where sub menus are possible.

Sorry Paul I was very busy with my project and excuse my lazy nature. :D

The version what I have posted before is capable of doing them. It is a little trick we have to follow to generate the sub menus.

If you want you can download the code here.. Asp Doi Menu.

ASP:
  1. Dim objMenu
  2. Dim mParent
  3. Dim mSubParent
  4. Set objMenu = New DoiMenu
  5. 'Create Root Menu and get the return value by calling it as function
  6. mParent = objMenu.Add ("","Staff","0","","","Option Menu")'
  7. 'Use the return value to put the menu under the root
  8. objMenu.Add mParent,"Home","","a","/staff/member/index.asp","Home"
  9. objMenu.Add mParent,"My Box","nmail.png","a","/staff/member/box/in.asp","Home"
  10. objMenu.Add mParent,"Check Mail","","a","/staff/member/mail.asp","Home"
  11. objMenu.Add mParent,"My Profile","","a","/staff/member/profile.asp","Home"
  12. objMenu.Add mParent,"Change Password","","a","/staff/member/cpass.asp","Home"
  13. objMenu.Add mParent,"Logout","","a","/staff/member/logout.asp","Logout"
  14. 'little more weird stuff
  15. mAssign = objMenu.Add (mParent,"Assign Permission","","","","Assign Report")
  16. Dim Sub_Assign_Menu(9)
  17. For I_D = 1 to 9
  18. Sub_Assign_Menu(I_D) = objMenu.Add (mAssign,arrUserType(I_D),"","","","Department " & arrUserType(I_D))
  19. Next
  20. Set Dep_Rs = Server.CreateObject ("adodb.recordset")
  21. Dep_Rs.CursorLocation = adUseClient
  22. Dep_Sql = "select users.id as Id, Profile.name, users.usertype  from users,profile where users.id=profile.userid"
  23. Dep_Rs.open Dep_Sql, Application("db"),adOpenForwardOnly,adLockReadOnly
  24. If Not Dep_Rs.EOF Then
  25. Do While Not Dep_Rs.EOF
  26. UId = cInt(Dep_Rs.Fields("id"))
  27. SName = Dep_Rs.Fields("name")
  28. Dep = cInt(Dep_Rs.Fields("usertype"))
  29. Assign_Url = "/staff/member/report/assign.asp"
  30. Assign_Url = AddVar(Assign_Url,"user",trim(cStr(UId)))
  31. XX= objMenu.Add (Sub_Assign_Menu(Dep),SName,"","a",objSes.SetTag(Assign_Url),"Assign for " & SName)
  32. Dep_Rs.MoveNext
  33. Loop
  34. Dep_Rs.Close
  35. End If

Advanced Asp Doi Menu

There are some other objects which I have used in the code. U can just ignore them when u implement in your code.
Have Fun.. ;-)