Create First MVC application in Visual Studio 2010

Leave a Comment

Open Visual Studio and create a new project named "MVC3EntityFrameworkDemo" using the ASP.NET MVC 3 Web Application template:

In the New ASP.NET MVC 3 Project dialog box select the Internet Application template and the Razor view engine, clear the Create a unit test project check box, and then click OK.

A few simple changes will set up the site menu, layout, and home page.

In order to set up the MVC3EntityFrameworkDemo menu, in the Views\Shared\_Layout.cshtml file, replace the existing h1 heading text and the menu links, as shown in the following example:
<body>
<divclass="page">
<divid="header">
<divid="title">
<h1>MVC3EntityFrameworkDemo</h1>
</div>
<divid="logindisplay">
@Html.Partial("_LogOnPartial")
</div>
<divid="menucontainer">
<ul id="menu">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Students", "Index", "Student")</li>
</ul>

0 comments:

Post a Comment