ASP Doi Menu Example

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

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] Dim objMenu
Dim mParent
Dim mSubParent
Set objMenu = New DoiMenu
'Create Root Menu and get the return value by calling it as function
mParent = objMenu.Add ("","Staff","0","","","Option Menu")'
'Use the return value to put the menu under the root
objMenu.Add mParent,"Home","","a","/staff/member/index.asp","Home"
objMenu.Add mParent,"My Box","nmail.png","a","/staff/member/box/in.asp","Home"
objMenu.Add mParent,"Check Mail","","a","/staff/member/mail.asp","Home"
objMenu.Add mParent,"My Profile","","a","/staff/member/profile.asp","Home"
objMenu.Add mParent,"Change Password","","a","/staff/member/cpass.asp","Home"
objMenu.Add mParent,"Logout","","a","/staff/member/logout.asp","Logout"
'little more weird stuff
mAssign = objMenu.Add (mParent,"Assign Permission","","","","Assign Report")
Dim Sub_Assign_Menu(9)
For I_D = 1 to 9
Sub_Assign_Menu(I_D) = objMenu.Add (mAssign,arrUserType(I_D),"","","","Department " & arrUserType(I_D))
Next
Set Dep_Rs = Server.CreateObject ("adodb.recordset")
Dep_Rs.CursorLocation = adUseClient
Dep_Sql = "select users.id as Id, Profile.name, users.usertype from users,profile where users.id=profile.userid"
Dep_Rs.open Dep_Sql, Application("db"),adOpenForwardOnly,adLockReadOnly
If Not Dep_Rs.EOF Then
Do While Not Dep_Rs.EOF
UId = cInt(Dep_Rs.Fields("id"))
SName = Dep_Rs.Fields("name")
Dep = cInt(Dep_Rs.Fields("usertype"))
Assign_Url = "/staff/member/report/assign.asp"
Assign_Url = AddVar(Assign_Url,"user",trim(cStr(UId)))
XX= objMenu.Add (Sub_Assign_Menu(Dep),SName,"","a",objSes.SetTag(Assign_Url),"Assign for " & SName)
Dep_Rs.MoveNext
Loop
Dep_Rs.Close
End If
[/asp]

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

By Imthiaz

Programmer, SAAS, CMS & CRM framework designer, Love Linux & Apple products, Currently addicted to mobile development & working @bluebeetle