Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1018917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:55:51+00:00 2026-05-16T10:55:51+00:00

Please help me solve my big problem. in my on-line shopping project i created

  • 0

Please help me solve my big problem.
in my on-line shopping project i created a dynamic Category List (with Infinite Level Depth) Implemented in a Single Table in DB with Self join.
the schema is like below:
alt text
(source: aspalliance.com)

Update
I want to use a JQuery plugin to make a Multi Level Menu bar. this plugin uses <ul> and <li> elements so I should transform the DB table to <ul> and <li>. the result should like this:

<ul>
  <li>Clothing 1
    <ul>
      <li>Trousers 2
        <ul>
          <li>Mens trousers 3</li>
          <li>Ladies trousers 3</li>
        </ul>
      </li> 
      <li>Jackets 2</li>
      <li>Shirts 2</li>
      <li>Shoes
        <ul>
          <li>Mens shoes 3
            <ul>
              <li>Mens formal shoes 4</li>
              <li>Mens casual shoes 4</li>
            </ul>
          </li>
          <li>Kids shoes 3</li>
          <li>Ladies shoes 3</li>
        </ul>
      </li>
    </ul>
   </li>
  <li>Cars 1
   <ul>
     <li>Small cars 2</i>
   </ul>
  </li>
</ul>

I can use a nested data control(like repeater control) but you know, with this solution i just can implement a list with non-infinite hierarchical tree structure.
please help me! any suggestion?? I googled the web but not a suitable way found. I use ASP.net 3.5 and LINQ.

what is the best way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T10:55:52+00:00Added an answer on May 16, 2026 at 10:55 am

    Use this recursive method

    private string GenerateUL(IQueryable<Menu> menus)
    {
        var sb = new StringBuilder();
    
        sb.AppendLine("<ul>");
        foreach (var menu in menus)
        {
            if (menu.Menus.Any())
            {
                sb.AppendLine("<li>" + menu.Text);
                sb.Append(GenerateUL(menu.Menus.AsQueryable()));
                sb.AppendLine("</li>");
            }
            else
                sb.AppendLine("<li>" + menu.Text + "</li>");
        }
        sb.AppendLine("</ul>");
    
        return sb.ToString();
    }
    

    like this

    DataClasses1DataContext context = new DataClasses1DataContext();
    var s = GenerateUL(context.Menus.Where(m => m.ParentID == null));
    Response.Write(s);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a long string, ex: Please help me to solve this problem. This
Could someone please help solve this problem?
Please help to solve this small problem: I try to decode incoming jpg data
please Help to solve this problem RewriteEngine On ErrorDocument 400 /tmp/error/404.html ErrorDocument 401 /404.html
Please help, I am stuck here --- irb> a = line of text\n line
Please help me convert this line to C#. objManagementBaseObject.SetPropertyValue(hDefKey, CType(&H & Hex(RegistryHive.LocalMachine), Long)) Related
Was wondering if somebody could please help me solve this. I've follwed all steps
please help me solve this issue. I have a client using WCF. I don't
Please help me solve this file path conflict: As you know, many HTML pages
please help my solve this error i get when i try to archive my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.