problem is solved, this is the DTO, simple. Next, we may want to use serialization in many places, so we define a method in the inside of the class and serialize ourselves for convenience. But again, because the entity class is generated by EF, each time we click Save, EF initializes the class according to the TT template and the XML configuration information, and the method we wrote is written in White. This time, we think of a partial class, a method that serializes the class in a partial cla
1: Unable to connect to LOCALDB databaseSolution: Download the LOCALDB installation software2: You are prompted to run the program when the database already exists, please change the connection nameSolution: Because the same connection string was used in two different solutions to generate the same database, when another solution created the database, the result of the program was not created, but the database actually existed, just not the same solution, so change the database name of the conne
The first parameter is the action name, the second parameter is the controller name @using (html.beginform ("CreateItem", "Knoledge")) { //each parameter corresponds to the namepublicactionresultcreateitem of the View input (stringm_ Struserid,stringm_strtitle,stringm_strdesc,stringm_dateuploadtime) { //database operation, is my own encapsulation, can ignore. Dictionary Less accustomed to the Entity Framework one is the feeling that the native SQL is more controllable, and the second is that E
1. First to see, without merging JS, the transmission volume is large1.1 Create a "basic" MVC ProjectThen create a new controller HomeController, because JS will be used in many views, so at this point we add a view with Layout page index view. To better see the effect, we remove something that will affect the effect.Code in 2.2 View, ultra-concise2.3 Start TestRun the view, and then monitor the sent requests in HttpWatchFound, this request index.csht
ViewContext (context,this. View,this. Viewdata,this. Tempdata,output); As the above method, the controller context, Viewdata,tempdata, is uploaded to ViewContext, which is the view context. This is then called. View.render (Viewcontext,output); Renders the view context as a parameter, however this. View is a iview interface, so we're going to look at who implemented the iview interface, such as the Razorview and Webformview view engines, to find the Renderview method, In this case, the ViewData
Change the Display field name Design field specification1. References1 using System.ComponentModel; 2 using System.ComponentModel.DataAnnotations;2.DisplayName value Public classBook { Public intBookID {Get;Set; } [DisplayName ("ISBN")] Public stringISBN {Get;Set; } [DisplayName ("Book name:")] [Required (ErrorMessage="name of the book must be filled")] Public stringBookName {Get;Set; } [DisplayName ("author")] [Required (ErrorMessage="The author must fill in")] Public s
Learning notes for ASP. net mvc 4 practice 8: Ajax (below ),
3. Ajax using JSON and client templates:
1. Use JSON Ajax:1) Add a model:{Public class Speaker {public int Id {get; set;} public string FirstName {get; set;} public string LastName {get; set;} public string PictureUrl {get; set;} public string Bio {get; set;} public string FullName {get {return string. format ("{0} {1}", FirstName, LastName );}}}}
Java.util.map;import com.yihaomen.model.article;import Com.yihaomen.model.user;public interface Iuseroperation {public User login (mapUser.xmlLabel configuration.xml ( reduce the length of the class name to set ), this has done a processing, The ID is directly equal to the method name, and if not, it is:Configuration.xml class:User entity classPackage Com.yihaomen.model;public class User {private int id;private string Username;private string Password;private stri ng userage;private String us
1. Action If you return a custom reference type, the default is to return the class name, which is called the ToString method of the class.2.@Html. Partial is used to render a partial view as a string @{html.renderpartial} writes the distribution view directly to the response output stream, so it can only be placed directly in a code block and cannot be placed in an expression (the return value is void) 3. The route URL cannot begin with ~ and/and cannot be included? Placeholder cannot be conti
code and the result is:In the browser, type: Home/index/10?name= Sun Quan? sex= ShemaleNote: The parameters entered here in the browser: Name,sex to be the same as the parameter name of the action method in the controller, it doesn't matter if the case is uppercase or lowercase.Obviously this is not the result we want, how to do it, for a moment to think of a good way, I modified the route: Public Static voidregisterroutes (routecollection routes) {routes. Ignoreroute ("{Resource}.axd/{*pathi
1, Controller/actionThe action returns a string directly for a business that does not need to return a large amount of HTML, similar to a generic handler.If you need to return a lot of HTML code, you need to return to view ();The view folder needs to add a folder with the same name as the controller and add an attempt file to it with the same name as the action method.1. Razor tried toFeatures: No angle brackets are seen as C # code, see angle brackets to know you write HTML code, automatically
From http://www.liuwu.net/post/aspnet-mvc-learning-5-html-actionlink.aspx
This article lists several methods of this method:
One html. actionlink ("linktext", "actionname ")
The first parameter of this overload is the text to be displayed on the link, and the second parameter is the method of the corresponding controller. The default controller is the controller of the current page. If the controller
ASP. net mvc 4.0 learning 4-Code First, mvc4-code
The data volume we used previously, by adding the Entity actual data volume model to pull the Database required in the data volume to the following example,
The Code First method is similar to this method for processing data.
Code First is more accurate. Developers Only need to write Code Only to automatically create models and data volumes.
Let's create a
InExtjs case series tutorialIn the first two lecturesExtjs learning: MVC model case study (2)We added the viewport. js and democontroller. js files to achieve the basic layout of the entire web page. This lecture makes the third part of our series of tutorials mainly implement the tree menu on the left side of the webpage, hoping to provide a guiding role for entry-level Web developers.
Next, we will add
Not long ago, I learned the webform of asp.net before learning MVC. I felt that thinking had changed a lot and I couldn't help using webform, so I forgot something about webform, start from scratch to understand MVC3.0. Below is a simple start.
In asp.net's webform, if you want to write, you will write a lot of SQL statements, such as INSERT INTO TABLE (), SELECT ..... In short, it is necessary to write a l
ExtJs4 Learning (7) Store and extjs4mvc in MVC
Ext. data. store is a standard middleware used in extjs for data exchange and data interaction. Both Grid and ComboBox use it to perform data read, type conversion, sorting paging, and search operations.
Ext.define('User', { extend: 'Ext.data.Model', fields: [ {name: 'loginname', type: 'string'}, {name: 'ip', type: 'string'} ]});
Store
ExtJs4 learning Store in MVC
Ext. data. store is a standard middleware used in extjs for data exchange and data interaction. Both Grid and ComboBox use it to perform data read, type conversion, sorting paging, and search operations.
Ext.define('User', { extend: 'Ext.data.Model', fields: [ {name: 'loginname', type: 'string'}, {name: 'ip', type: 'string'} ]});
Store can read data from
In the background user management module:The user is divided into three categories: 0 for registered members, 1 for administrators, and 2 for Super AdministratorsPages and Features:
User List Page.
Show all users (admin, Super Admin)
Query specified user (Email, Status) based on criteria (admin, Super Admin)
Delete the User. (super Admin)
Modify the user State. (admin, Super Admin)
Jump to the details Page. (admin, Super Admin)
Jump to new page (super Admi
_layout Code:1234"Utf-8"/>5"Viewport"Content="Width=device-width"/>67@RenderSection ("Headarea", Required:false)89Ten @RenderBody () One A@RenderSection ("Bodyarea", Required:false) - - theUse the Sub-page code for the layout page:1 @{2 //The layout property of this page has been assigned in _viewstart.cshtml! 3Viewbag.title ="Sonpage";4 }5 678I love Guangzhou small waist ~~~~9I love bungee jumping ~ ~ ~! Ten One"Bodyarea", Required:false), Required:false is not required- A @secti
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.