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 7985911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:41:36+00:00 2026-06-04T11:41:36+00:00

I have a unique sql database setup in which I’m using nested sets to

  • 0

I have a unique sql database setup in which I’m using nested sets to determine the hierarchy. Here’s an example of it:

HierarchyID = 1, HierarchyText = “Contract”, HierarchyLeft = 1,
HierarchyRight = 54

HierarchyID = 2, HierarhcyText = “Part 1…”, HierarchyLeft = 2, HierarchyRight = 41

HierarchyID = 3, HierarchyText = “Part 2…”, HierarchyLeft = 42,
HierarchyRight = 45

HierarchyID = 8, HierarchyText = “General Provisions”,
HierarchyLeft = 3, HierarchyRight = 40

The idea is that the children (or subcategories) are contained within the parent’s LEFT and RIGHT values. So, for instance, “General Provisions” is a child of “Part 1…” which is a child of “Contract”. “Part 1…” and “Part 2” are siblings of each other since they don’t contain each other going by the left and right values.

The question I have is this: Is there a way to use MVC3 with Razor Engine to create a tree and display it pulling from this database? The only examples I’ve seen have been databases that have each node in the database pointing to its parent. If it’s possible, could you provide sample code for the CONTROLLER and VIEW? I’d appreciate that. Also, I’m able to pull the hierarchy names by level. So, I’d appreciate an example in which I could feed the tree control a level at a time. For instance, feed the top level… when the user clicks on it, feed the next leve, etc. down the tree. I would really appreciate any help!

  • 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-06-04T11:41:38+00:00Added an answer on June 4, 2026 at 11:41 am

    You seem to be using the Nested Set Model to define hierarchical data. Personally I would use recursive display templates once the data is fetched from the database into a view model to display the tree. Here’s an example in which I illustrated similar concepts in action which you could adapt to meet your specific requirements.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an SQL database with a set of tables that have Unique Id's.
Do index names have to be unique accross the entire sql server database, or
I have just setup a Sql Server db using the same mappings and source
I have a SQL database which i use to store some info and every
I have a column (which represents an e-mail) in a SQL Server database with
I have rows in an Oracle database table which should be unique for a
I have multiple apps running which access a sql server database. I had initially
I have a unique requirement that I hope is possible with LINQ to SQL.
I rarely use SQL and have a unique issue I need to solve. I
Does each column of a table in SQL Server have a unique id? I've

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.