In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "how to use ASP.NET MVC3 beta". In daily operation, I believe many people have doubts about how to use ASP.NET MVC3 beta. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to use ASP.NET MVC3 beta". Next, please follow the editor to study!
The first is the change in the selection interface when you create the project:
The change of 1.View Engine.
The View engine of Razor has been added to asp.net mvc 3.
If you create a project with both Index.aspx and Index.cshtml, the default MVC will choose aspx's view to display. But you can ask MVC to execute Razor Engine's Index.cshtml page first by adding the following code to the Application_Start method in the Global.asax file.
The code is as follows:
ViewEngines.Engines.Clear (); ViewEngines.Engines.Add (new RazorViewEngine ()); ViewEngines.Engines.Add (new WebFormViewEngine ())
two。 You can modify the display order of attributes in Model at will.
In previous versions, if we created the following Model:
Public class Employee {public string FirstName {get; set;} public string LastName {get; set;} public int EmployeeId {get; set;}}
Create a View code for this Model as follows:
Employee Details
After running, you can see that the property fields of the Employee class are displayed as follows:
In asp.net mvc 3, we can flexibly modify the arrangement of fields on the View page by setting the display order of the properties, for example:
Run the program again, and the Employee is displayed as follows:
three. Grid control has been added
Let's use the Employee above to create a Grid:
Display the code for the Controller section:
In the View section, we use WebGrid in the System.Web.Helpers class to display several of the above Employee information.
Run, the results are as follows:
We set up 'FirstName'' to sort. You can change the sort by clicking on the headers of other columns.
4. Chart component has been added
Let's create a bar chart showing employee sales performance based on the relationship between Employee and Sales.
We create a Model for EmployeeSale
The Controller section adds a ShowChart control:
* is the View part:
It should be noted here that the Chart control is displayed by creating a temporary png image, which is not saved on the server side after page access.
Running effect:
At this point, the study on "how to use ASP.NET MVC3 beta" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.