简体   繁体   English

如何从db中获取值以在ASP.NET MVC3 Razor中进行建模

[英]How to get values from db to model in ASP.NET MVC3 Razor

Hello in my project i have to implement Dynamic Menu using ASP.NET MVC3 Razor .Here i have database table named menu and menuItems.My menu structure is 您好在我的项目中,我必须使用ASP.NET MVC3 Razor来实现动态菜单。在这里,我有一个名为menu和menuItems的数据库表。我的菜单结构是

1.UserManagement 1.1Create new user 1.2Create new Role 2.Accounts 2.1Income 2.2Expense 1.用户管理1.1创建新用户1.2创建新角色2.帐户2.1收入2.2费用

UserManagement and Accounts are menus and Create new user,Create new Role,Income, and Expense are menu Items.So i have created two models named Menu and MenuItems . UserManagement和Accounts是菜单,而Create new user,Create new Role,Income和Expense是菜单项。因此,我创建了两个名为Menu和MenuItems的模型。

My question is 我的问题是

1.How to get Data from db 1,如何从数据库获取数据
2.How to pass this menu and menu items to a view page using controller 2.如何使用控制器将此菜单和菜单项传递到视图页面

I am beginner in ASP.Net MVC3 Razor but have experience in ASP.Net C# 我是ASP.Net MVC3 Razor的初学者,但是具有ASP.Net C#的经验

Model Code and View Code are posted in my another post. 模型代码和查看代码发布在我的另一篇文章中。

Dynamic Menu loading in ASP.Net MVC3 Razor 在ASP.Net MVC3 Razor中动态加载菜单

检查此URL以获取您的问题解决方案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM