•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 427,939 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,815 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 962 | Replies: 2 | Solved
![]() |
•
•
Join Date: Aug 2007
Location: Somewhere between heaven and hell
Posts: 101
Reputation:
Rep Power: 2
Solved Threads: 7
Hi Nithya. G,
I use EssentialObject menu control to create dynamic menu.
Thanks,
Kusno.
I use EssentialObject menu control to create dynamic menu.
Sub CreateMenu()
Dim MI As EO.Web.MenuItem
Dim MII As EO.Web.MenuItem
Dim MIII As EO.Web.MenuItem
Dim Add As Boolean
MyMenu.Items.Clear()
MyMenu.EnableScrolling = True
MyMenu.EnableViewState = False
MyMenu.ScrollDownLookID = "scroll_down"
MyMenu.ScrollUpLookID = "scroll_up"
MyMenu.ScrollSpeed = 100
Dim SQL As String
Dim I As SByte = 0
Dim CnMenu As New SqlClient.SqlConnection
Dim CnSubMenu As New SqlClient.SqlConnection
Dim CnFunction As New SqlClient.SqlConnection
SQL = "Select MasterMainMenu.MainMenuID, MasterMainMenu.MainMenuName, MainMenuLink from MasterMainMenu order by Seq "
GetCN(CnMenu)
Dim CmMenu As New SqlClient.SqlCommand(SQL, CnMenu)
Dim RdMenu As SqlClient.SqlDataReader
RdMenu = CmMenu.ExecuteReader()
Do While RdMenu.Read
MI = New EO.Web.MenuItem
MI.ItemID = RdMenu.Item("MainMenuID").ToString.Trim
MI.Text.Html = RdMenu.Item("MainMenuName").ToString.Trim
If RdMenu.Item("MainMenuLink").ToString.Trim <> "" Then MI.NavigateUrl = RdMenu.Item("MainMenuLink").ToString.Trim
MI.HoverStyle.Font.Size = 8
MI.HoverStyle.Font.Bold = True
MI.NormalStyle.Font.Bold = True
MI.NormalStyle.Font.Size = 8
MI.HoverStyle.ForeColor = Drawing.Color.RoyalBlue
MyMenu.Items.Add(MI)
SQL = "Select FunctionID, SubMainMenuName, SubMainMenuID, FunctionLink from MasterSubMainMenu where MainMenuID='" & RdMenu.Item("MainMenuID").ToString.Trim & "' Order By Seq"
GetCN(CnSubMenu)
Dim CmSubMenu As New SqlCommand(SQL, CnSubMenu)
Dim RdSubMenu As SqlClient.SqlDataReader
RdSubMenu = CmSubMenu.ExecuteReader
Do While RdSubMenu.Read
MII = New EO.Web.MenuItem
MII.ItemID = RdSubMenu.Item("SubMainMenuID").ToString.Trim
MII.HoverStyle.ForeColor = Drawing.Color.Red
MII.HoverStyle.Font.Size = 8
MII.HoverStyle.Font.Bold = True
MII.NormalStyle.Font.Bold = True
MII.NormalStyle.Font.Size = 8
MII.Text.Html = RdSubMenu.Item("SubMainMenuName").ToString.Trim
If SetStringValue(RdSubMenu.Item("FunctionLink")) <> "" Then
If Security.IsUserAllowed(Session("UserId"), SetStringValue(RdSubMenu.Item("FunctionID")), UserAccess.CanDisplay) = True Then
MII.NavigateUrl = RdSubMenu.Item("FunctionLink").ToString.Trim
MII.Status = RdSubMenu.Item("FunctionLink").ToString.Trim
Add = True
End If
Else
SQL = "Select MasterFunction.FunctionID,MasterFunction.FunctionName,FunctionLink, FunctionTarget from MasterUserFunctionDetail inner join MasterFunction On MasterFunction.FunctionID=MasterUserFunctionDetail.FunctionID where MasterUserFunctionDetail.UserID='" & Trim(Session("UserID")) & "' and MasterFunction.MainMenuID='" & SetStringValue(RdSubMenu.Item("SubMainMenuID")) & "' and ISNULL(DISABLED,'') = 'N' Order By MasterFunction.Seq "
GetCN(CnFunction)
Dim CmFunction As New SqlCommand(SQL, CnFunction)
Dim RdFunction As SqlClient.SqlDataReader
RdFunction = CmFunction.ExecuteReader
If RdFunction.HasRows = False Then
Add = False
Else
Do While RdFunction.Read
If Security.IsUserAllowed(Session("UserId"), RdFunction.Item("FunctionId").ToString.Trim, UserAccess.CanDisplay) = True Then
MIII = New EO.Web.MenuItem
MIII.ItemID = RdFunction.Item("FunctionId").ToString.Trim
MIII.HoverStyle.Font.Size = 8
MIII.HoverStyle.Font.Bold = True
MIII.HoverStyle.ForeColor = Drawing.Color.Red
MIII.NormalStyle.Font.Bold = True
MIII.NormalStyle.Font.Size = 8
MIII.NavigateUrl = RdFunction.Item("FunctionLink").ToString.Trim
MIII.Status = RdFunction.Item("FunctionLink").ToString.Trim
MIII.Text.Html = RdFunction.Item("FunctionName").ToString.Trim
MIII.TargetWindow = RdFunction.Item("FunctionTarget").ToString.Trim
MII.SubMenu.Items.Add(MIII)
End If
Loop
Add = True
End If
SetToNothing(CnFunction, RdFunction, CmFunction)
End If
If Add = True Then MyMenu.Items(I).SubMenu.Items.Add(MII)
Loop
I = I + 1
SetToNothing(CnSubMenu, RdSubMenu, CmSubMenu)
Loop
SetToNothing(CnMenu, RdMenu, CmMenu)
End SubThanks,
Kusno.
NEVER NEVER NEVER GIVE UP
![]() |
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- dynamic menu using ruby (Ruby)
- Help with dynamic menu (HTML and CSS)
Other Threads in the ASP.NET Forum
- Previous Thread: Creating Dynamic Crystal Reports at runtime in .Net?
- Next Thread: Gaming site


Linear Mode