asp.net MVC3 Simple Tutorials (i) Environmental preparedness

Source: Internet
Author: User

Original address: www.cnblogs.com/fly_dragon/archive/2011/06/12/2078648.html asp.net mvc has gone to the third edition, I believe we are all familiar with, I also no longer repeat the relevant conceptual things. But you must understand that asp.net mvc is an open source UI layer framework for Microsoft and is another development model for ASPNET.

asp.net mvc has been to the third edition, I believe we are all familiar with, I do not repeat the relevant conceptual things. But you must understand that asp.net mvc is an open source UI layer framework for Microsoft and is another development model for ASPNET. The good nonsense does not say much, that we begin to enter ASP.net MVC3 the study to come, 工欲善其事, its prerequisite. Therefore, we must build our own development environment in order to our next study and development to provide better support.

The prerequisites for your machine are:

1 VS2010 (of course you have to use VS2008 then I can't say anything)

2) SQL Server 2000/2005/2008

3 asp.net MVC3 installation package (should be required VS2010SP1)

Below provide some URL links to facilitate the download of learning:

1) ASP.net MVC3 's official website: HTTP://WWW.ASP.NET/MVC/MVC3

As shown in the following illustration:

This may be a very long time in the installation process (>=20 minutes), everyone patience.

2) installation asp.net MVC3 installation package

Http://www.microsoft.com/web/gallery/install.aspx?appid=MVC3

3) ASP.net MVC3 source Source address:

http://aspnet.codeplex.com/releases/view/58781

As shown in the following illustration:

section II: The first asp.net MVC3 project

1) Create the project:

2 Select the project's default view engine

We select a empty template and then select the Razor view engine (the new view engine provided in ASP.net MVC3) Select HTML5 Tag Support tick (this piece I do not understand, hehe, I hope to do this piece of research experts to share with me. )。

3 After the creation of the project:

asp.net MVC3 looks like the project template that was created with the previous version is no different, and the folders are basically similar. Of course we see the jquery package in the folder updated to 1.5.1. Each folder is described in the following article. There's not much to be wordy about here.

4 Add code and run up our first demo

First: Right-click on the Controller folder, select Add menu, then select Controller, as shown in the following figure:

Then pop-up dialog box, the controller named HomeController, pay attention to the back of the controller do not remove, otherwise it will not be recognized as controller, and finally click Add. As shown in the following illustration:

The designer automatically generates code for us as 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 we add the view we need on the action, as follows:

5 Add our own HTML tags to the front page @{
Viewbag.title = "Index";
}

< h2 > Index


Note: Red for our own added part

6) Final result:

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.