What is MVC MVC?

Source: Internet
Author: User

ASP. NET MVC is a very good open source Web site development Framework
To learn MVC first you need to get back to these skills.
Basic MVC for C #, ADO, (LinQ) HTML, JavaScript, and ASP. WebForm (Model View Controller-View-Controller)
The MVC development model is more concise and very close to "request-process-response", and his base code is the same as WebForm
1.1. Build a project-Create a new MVC4 project select the Basic project template, the ASPX view engine
After the new success you will see a lot of directories, directory features:
App_Data: Storing database files
App_start: A class file that is used to store important configuration when the Web application starts (RouteConfig.cs) The main introduction to this class library, first he will give you
A default path, name: "Default", url: "{controller}/{action}/{id}", defaults:new {controller = "director name",
Action = "Method name to execute", id = urlparameter.optional},
Note: (name refers to the default path, the URL is the way you write the address, defaults is the default path to execute)
Content: folders are used to store theme style files
Controllers: folder for storing controller class files
Models: Folders are used to hold data model layer files
Scripts: folder to hold script files
Views: folders for storing view files
1.2. New controller
Right click on the controllers, select Add, then click on the controller, create a side (the controller's name is generally the beginning of the home, because in the "App_start"
The default is home)
1.3. Create a new view
After the controller page is set up, right click on index and Add view, when adding view, note that the view name should not be changed as far as possible, the view engine chooses ASPX (C #), the remaining
option is not checked. Click Add to create the success.
Public ActionResult Index ()
{
return View ();
}
1.4. Writing procedures
Controller:
Controller reference:
Using SYSTEM.WEB.MVC;
Data binding:
Public ActionResult Index ()
{
viewdata["Data" = "datasource";
return View ();
}
View:
References in view: <%@ Import namespace= "Mvcdeom.models"%>
Data display:
<%IEnumerable< table > List = viewdata["Data"] as ienumerable< table >;%>
<%= Data%>
Control (Controller) is passed through a container to the foreground page view (view) to display the data in the container

I get this data source mainly through LINQ, because LINQ statements are easier to understand HAHAHA!!!

What is MVC MVC?

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.