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 ThenDim childItem As New MenuItem(childRow("LinkName").ToString(), "SomeValue", String.Empty, (childRow("ExternUrl").ToString))
masterItem.ChildItems.Add(childItem)
ElseIf (childRow("UrlCategory")) = 2 ThenDim 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)
ElseDim 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