Menu problems

Last post 05-11-2008 8:15 PM by Peter Lee. 1 replies.

Sort Posts:

  • Menu problems

    05-09-2008, 5:28 AM

    Hi,

    Hope someone can help me with this problem.

     My problem is to get the top-level in my menu without link. I only want to have the top-level as header and then the childnodes as links.

     Here is the code:

    Sub PopulateMenu()

    Dim dst As System.Data.DataSet = GetMenuData()

    For Each masterRow As System.Data.DataRow In dst.Tables("tbl_HeadMenu").Rows()

    Dim masterItem As New MenuItem(masterRow("LinkName").ToString())

    Menu1.Items.Add(masterItem)

    For Each childRow As System.Data.DataRow In masterRow.GetChildRows("Children")

    If (childRow("UrlCategory")) = 1 Then

    Dim childItem As New MenuItem(childRow("LinkName").ToString(), "SomeValue", String.Empty, (childRow("ExternUrl").ToString))

    masterItem.ChildItems.Add(childItem)

    ElseIf (childRow("UrlCategory")) = 2 Then

    Dim childItem As New MenuItem(childRow("LinkName").ToString(), "SomeValue", String.Empty, "~/default2.aspx?page=SPage&HId=" & (childRow("HId").ToString) & " &PId=" & (childRow("PIdIntern").ToString))

    masterItem.ChildItems.Add(childItem)

    Else

    Dim childItem As New MenuItem(childRow("LinkName").ToString(), "SomeValue", String.Empty, "~/default2.aspx?page=SPage&HId=" & (childRow("HId").ToString) & " &PId=" & (childRow("PId").ToString))

    masterItem.ChildItems.Add(childItem)

    End If

    Next

    Next

    End Sub

     

    Hope anyone can help me?!

     Regards T

  • Re: Menu problems

    13 hours, 46 minutes ago
    • Loading...
    • Peter Lee
    • Joined on 07-02-2007, 4:34 PM
    • Virginia, USA
    • Posts 61

    Hi T,

     You can set the NavigateUrl, either at design time as an attribute on the menuitem tag, or programmatically using the navigateurl parameter, to

    NavigateUrl="javascript: void(0);"

     That will create a dead link.

    Pete

Page 1 of 1 (2 items)