Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to generate an unordered list from database table data?
    primarykey
    data
    text
    <p>hi i have an unordered list <code>&lt;ul&gt;&lt;li&gt;&lt;ul&gt;&lt;li&gt;</code></p> <p>I had made a table to fill the unordered list but how to fetch that data into <code>li</code> and <code>ul</code> the table consists of home, organisation (with children as policy, employeesdetails), and so on.. How do i fill these <code>ul</code> and <code>li</code>'s and children of <code>li</code>'s with data from sqlserver2005 table? I'm not supposed to use any asp.net built in controls like asp.net menu</p> <pre><code>foreach (DataRow row in dt.Rows) { int currentDepth = Convert.ToInt32(row["Depth"]); if (lastDepth &lt; currentDepth) { output.Append("&lt;ul class=\"dropdown\"&gt;"); numUL++ ; } else if (lastDepth &gt; currentDepth) { output.Append("&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;"); numUL-- ; } else if (lastDepth &gt; -1) { output.Append("&lt;/li&gt;"); } output.AppendFormat("&lt;li class=\"depth-{1}\"&gt;{0}", row["ApplicationName"], currentDepth); lastDepth = currentDepth; } for (int i = 1;i &lt;= numUL;i++) { output.Append("&lt;/li&gt;&lt;/ul&gt;"); } Literal1.Text = output.ToString(); </code></pre> <p>i have made the navigation bar based on above code my navbar looks like this</p> <blockquote> <p>Home|Organisation|Recruitment|Help|Issues</p> </blockquote> <p>i am getting all the li's properly(like department and users under organisation) i have one prolem how do i get the urls dynamically to the above code</p> <p>my table looks like this</p> <pre> ApplicationID ApplicationName ParentKey Depth URL 1 HOME NULL 0 # 2 Organisation NULL 0 # 3 Department 2 1 # 4 User 2 1 # 5 Issues NULL 0 # 6 issuestrack 5 1 # 7 Help NULL 0 # 8 helpneeded 7 1 # </pre> <p>thanx in advance</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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