Start the first MVC Project
Create a project:
Select an empty template, and then select the axpx view engine (the new view engine provided in ASP. NET mvc3) to check the HTML5 tag support.
The created Project:
In ASP. NET mvc3, The jquery package in the folder is updated to 1.5.1. TheArticleIn the left-side navigation pane.
Run our first demo
First, right-click the Controller folder, select Add menu, and then select controller, as shown in:
In the dialog box that appears, name the Controller homecontroller. Do not remove the controller. Otherwise, it will not be recognized as the controller. Click Add.
As shown in, the designer automatically generatesCodeAs follows:
Using system; Using system. Collections. Generic; Using system. LINQ; Using system. Web; Using system. Web. MVC; Namespace mvcapplication1.controllers { Public class homecontroller: Controller { // // Get:/home/ Public actionresult index () { Return view (); } } } |
Next, add the view we need on the action.
Add our own HTML tag on the front-end page
<H2> index </H2> <H1> hello! It's my first ASP. net mvc web! </H1> |
Final result:
Summary
The first article does not explain in depth the respective functions of folders generated by the entire project, and ASP. some related concepts of. Net MVC are just a simple demonstration example. We will introduce them in detail in the following article.