Skip to content Skip to sidebar Skip to footer

How To Create Hierarchical Menu From Different Table Based On Sample Database Structure

I am working on a website with a menu structure so that it can read submenus from multiple table below is Sample Menu example I have several table like pg_Pages, art_Article, art_

Solution 1:

as per your question....

-create a sql query by with clause and make a one single table with coming your all records. after that choose any html table menu ...in that on ul tag set main menu item(for that you can use data reader etc. control).it's easy way....

after that if you are not getting thn let me know...i made this type of menus....i will provide sample code....

Solution 2:

There are many different ways to handle building menus.

  • Build a stored procedure to do all the hard work.
  • Select the data from the database, and build the strings in application code.
  • Build a file from the database that you can include at "make" time.
  • Do everything in a SQL query.

My least favorite option for things like menus is to do everything in a SQL query. If I were in your shoes, I think my first choice would be to build a file that I could include at "make" time. My second choice would be to select data from the database, and build the strings in application code.

Building a file to include at make time will perform better. It's easier to code in SQL, because the number of simple queries you need doesn't really matter. (It's done at "make" time, not at run time.) And it handles menus of arbitrary complexity with no run-time penalty. (Again, because it's done at make time.) But it might create maintenance issues, depending on how often the menus need to change.

Post a Comment for "How To Create Hierarchical Menu From Different Table Based On Sample Database Structure"