Hjr-asp.net:.net mvc__.net

Source: Internet
Author: User

The previous article has WebForm and html+ashx way development, the following emphasis says MVC creates

VS in New Web project, next select MVC, the project can be built directly to run the test structure

Main Model Folder View folder Controller folder

Content folder put CSS file, scripts folder to put JS file cshtml

The view template file, which will eventually be View+controller to a pure HTML file, corresponds to a folder in the view with several cshtml files in each module of the Web site. and each module name in the Model folder has the module name +controller controller file corresponding, the controller file has several methods and view of the cshtml respectively corresponding. When the URL suffix access to/module name, enter the appropriate controller, when access to/module name/cshtml file name, enter the corresponding method in the controller, in the method will do some data operation after return view () returned to the Web page after the cshtml file. do some data manipulation

The above bold to do some data operation specific implementation:

By passing in the model parameter in the controller, you can directly use the data defined in model, after obtaining the data, you can do the middle operation like assigning to the page template. Model

The model can do some database operations, such as using an ORM (Object Relational Mapping) framework, or using the Dbhelp file to manipulate the database itself, and define the parameters, Get/set, and so on.
in general, the class name corresponds to the table name, the property corresponds to the field The example uses ORM framework, constructs a class name corresponding table name, the attribute corresponding field model constructs a table module, inside has the increment to check four cshtml files, each file writes corresponding Template table's controller, inside has the enhancement check corresponding method, Reference to model, ID in each method to write a good corresponding operation

www.xxx.com/table/Check
The table will be displayed
www.xxx.com/table/Change
The edit page will be displayed

The appropriate method to access the table controller when the operation enters the page

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.