ASP.NET 菜单:如何构建自定义菜单
我遇到这种情况:我必须使用数据库中的数据源构建一个菜单,因为我必须在登录的用户中过滤它们。我尝试使用中继器构建一个菜单,所有这些工作正常,直到我意识到我想要两层以上的菜单。我也尝试过使用树视图,但我真的不想要这个解决方案(样式问题,树视图没有漂亮的视图)。
有人能给我这个想法吗?
提前谢谢。
i have this situation: i have to build a menu with datasource from the db, because i have to filter them among the user that is loged in. i have tried building a menu using repeater, and all this works fine till i realized that i wanted the menu with more than two levels. i have also tried with treeview, but i really don't want this solution (problem with the style and the treeview doesn't have a pretty view).
Could anyone give me just the idea ?
thnx in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您以传统方式保护页面(即使用 ASP.NET 的内置权限系统),则可以仅使用普通的 SiteMapProvider,因为它们会为您安全修剪菜单。
如果您需要进行自定义,请尝试创建一个实现 IHeirarchicalDataSource,然后将任何适当的内容(例如 ASP.BulletedList)绑定到它。
If you are securing your pages in the conventional sense (ie--using ASP.NET's builtin permissions system), you can just use the normal SiteMapProviders as they will security trim menus for you.
If you need to do custom, try making a class that implements IHeirarchicalDataSource and then bind anything appropriate (eg--ASP.BulletedList) to that.