asp.net MVC 数据库驱动的导航菜单

发布于 2024-08-23 17:26:04 字数 169 浏览 2 评论 0原文

有人能指出我如何实现由数据库驱动的分层导航菜单的正确方向吗?我不想在这里重新发明轮子,所以我想知道是否已经做了一些事情。我知道 asp.net 中的菜单控件,但据我所知,它不适用于 MVC。是否有一些已经作为框架的一部分提供的东西可供我用于此目的?如果没有,那么也许有一些链接可以为我指明正确的方向?

谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

_畞蕅 2024-08-30 17:26:04

LBushkin的想法是好的。有关从数据库发出

  • 标记的方法,请查看以下博客文章:

ASP.NET MVC 递归树视图助手
http://www.matthidinger.com/archive/2009/02/08/asp.net-mvc-recursive-treeview-helper.aspx" matthidinger.com/archive/2009/02/08/asp.net-mvc-recursive-treeview-helper.aspx

使用 ASP.NET MVC 框架呈现 TreeView
http://mikehadlow.blogspot.com/ 2008/10/rendering-tree-view-using-mvc-framework.html

我个人使用 Matt Hidinger 的递归 TreeView Helper 的修改版本,并为其提供几个 IQueryable我的数据库。

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.

错々过的事 2024-08-30 17:26:04

你可能想看看 superfish - 它是一个 jQuery灵活且使用语义标记的兼容菜单控件。您可以通过发出一组适当的

  • 标签来菜单。甚至可以通过将列表嵌套在其他列表中来嵌套它们以创建分层菜单。

它不直接与数据库表示交互 - 但很容易将这样的结构作为

    标签发送到标记中并将 superfish 应用于它。

You may want to look at superfish - it's a jQuery compatible menu control that's flexible and uses semantic markup. You can menus by just emitting an appropriate set of <ul> and <li> tags. They can even be nested to create hierarchical menus by just nesting lists within other lists.

It doesn't directly interface with a database representation - but it's easy enough to emit such a structure into markup as <ul> tags and apply superfish to it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文