Note that there are some explanatory texts on larger screens.

plurals
  1. POmenu with hierarchical data
    primarykey
    data
    text
    <p>I have a Hierarchical Table for Categories in this form <code>NodeID</code> <code>ParentID</code> <code>NodeName</code> </p> <p>Following is the code i am using generate <code>ASP.NET MENU ITEMS</code> and bind it to <code>MENU CONTROL</code></p> <pre><code>Private Sub displayMenu() Using con As New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("HagglerEntLibConStr").ConnectionString) Using sql As New SqlCommand("Select NodeID,ParentID,NodeName FROM Nodes", con) con.Open() Dim r As SqlDataReader = sql.ExecuteReader 'stored procedure that returns the above SqlDataReader Dim tempMaster As New MenuItem() Dim bagMaster(700) As MenuItem Dim j As Integer = 0 Do While r.Read() tempMaster.Value = r("NodeID").ToString() tempMaster.ToolTip = r("ParentID").ToString() tempMaster.Text = r("NodeName").ToString() tempMaster.NavigateUrl = "" bagMaster(j) = tempMaster j += 1 tempMaster = New MenuItem() Loop r.Close() Menu1.Items.Clear() For i As Integer = 0 To j - 1 If i = 0 Then Menu1.Items.Add(bagMaster(i)) Else For x As Integer = 0 To j - 1 If bagMaster(i).ToolTip = bagMaster(x).Value Then Dim c As MenuItem = bagMaster(x) 'you can change the tool tip here if you want c.ChildItems.Add(bagMaster(i)) End If Next x End If Next i 'Menu1.Items.RemoveAt(0) End Using End Using End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load displayMenu() End Sub </code></pre> <p>Everything works fine ...but the main disadvantage with this approach is that the <code>Menu CONTROL</code> creates <code>HTML TABLES</code>...i have around 1000 rows in the table..this creates a multi level menu ...which adds a lot of <code>HTML Tables</code> in the page and increases the page load time drastically...how do i tackle this issue?? This is the way the menu populates.</p> <p><img src="https://i.stack.imgur.com/8gYcR.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload