Introduction to ASP. net mvc and asp. netmvc

Source: Internet
Author: User

Introduction to ASP. net mvc and asp. netmvc

The full name of MVC is Model View Controller, short for model-view-controller. It is a Model of software design, organize Code by means of separation of business logic, data, and interface display, and integrate the business logic into a component to improve and personalize the custom interface and user interaction, you do not need to rewrite the business logic. MVC is uniquely developed to map traditional input, processing, and output functions in a logical graphical user interface structure.

MVC is one of three ASP. NET Programming modes.

Model (Model layer) indicates the application CORE (such as the database record list ).

View (View layer) displays data (database records ).

Controller (Controller/layer) processes input (written to database records ).

 

Create an MVC Program

Create a project

ASP. net mvc 4 Web Applications

Select template-control; view engine-ASPX

After you click OK, VS will automatically generate five folders and related configuration files. The names of these five folders cannot be changed, and corresponding sub-pages are placed in the corresponding folder, you do not need to specify the folder name when using it.

 

App_Data folder

App_DataFolder is used to store application data.

Controllers folder

The Controllers folder contains the Controller class responsible for processing user input and the corresponding.

MVC requires that the names of all Controller files end with "Controller.

Models folder

The Models folder contains classes that represent the application model. The model controls and operates application data.

Views folder

The Views folder is used to store HTML files (user interfaces) related to application display ).

The Views folder contains a folder corresponding to each controller.

 

Daily use of MVC:

1. MVC needs to be generated frequently

2. Data can be displayed on any page

3. Place LinQ in the model and reference the namespace for use.

4. You cannot use the WebForm control on the MVC View page.

5. Use reference data or C # code on the MVC View page, which must be placed in <% code %>. Reference of the namecontrol <% @ important Namespace = "" %>

 

 


Layer C
Consists of the actions in the Controller and controller.
The MVC request is not directly to the page, but to send a request to an action in the controller.

The Index action under the Home controller is returned by default.

If the requested controller does not have a request action, the Index action under the controller is returned by default.

Related 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.