MVC 3 entry 02 start the first MVC Project

Source: Internet
Author: User
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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.