asp.net MVC3 Brief introduction to the first season (i) Environmental preparedness

Source: Internet
Author: User

Original http://www.cnblogs.com/fly_dragon/archive/2011/06/12/2078648.html

Preface

Hello everyone, from today I will write a summary of the study of the MVC3 of the ASPNET, and with beginners to share some basic knowledge, the author himself is also willing to communicate with the technology, together with the progress of exchange, welcome the experts are not hesitate to enlighten, welcome different opinions and suggestions, The author's knowledge and insight, of course, has its own limitations, I hope that he can become a not boring type of technical personnel, rather than just enjoy the technology, but not to allow more people to share your achievements of the people. section I.: About asp.net MVC3

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";
}


Note: Red for our own added part

6) Final result:

Section III: summary

Although the first article did not write much, but now it is late at night. I have to continue working overtime tomorrow. I'll write here for the time being. Of course, this article has not in-depth explanation of the entire project created by the role of the folder, as well as some of the relevant concepts of asp.net MVC, but simply a demo example, there is no technical content, I hope the following article will be introduced in detail, let us look forward to the following.

Download address for Word version of this article: Http://files.cnblogs.com/fly_dragon/2011%E5%B9%B46%E6%9C%8811%E6%97%A522mvc.zip

In: June 12, 2011 0:10:58

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.