Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp.net MVC database driven navigation menu

Tags:

can anybody point me in the right direction as to how I would go about implementing a hierarchical navigation menu which is driven by database? I don't want to re-invent the wheel here, so I was wondering if there is something that's already been done. I'm aware of the Menu control in asp.net, but from what I figure it won't work with MVC. Is there something that's already provided as part of the framework that I can leverage for this purpose? If not, then maybe a few links to point me in the right direction?

thanks.

like image 701
Riz Avatar asked Mar 02 '10 23:03

Riz


1 Answers

LBushkin's idea is a good one. For ways to emit the <ul> and <li> tags from the database, have a look at the following blog posts:

ASP.NET MVC Recursive TreeView Helper
http://www.matthidinger.com/archive/2009/02/08/asp.net-mvc-recursive-treeview-helper.aspx

Rendering a TreeView using the ASP.NET MVC Framework http://mikehadlow.blogspot.com/2008/10/rendering-tree-view-using-mvc-framework.html

I personally use a modified version of Matt Hidinger's recursive TreeView Helper, and feed it a couple of IQueryables from my database.

like image 165
Robert Harvey Avatar answered Oct 04 '22 20:10

Robert Harvey