List of Model Object Post to Controller in ASP.NET
2016-08-23
0 0 0
no vote
Other
Earn points
Translated by maninwest@Codeforge Author:Saswat Mohanty@CodeProject
Several times, we want to post list of model object from view to controller while HttpPost. Many developers try to get the list of data through an array. But I'll tell you without using array also, we can get those list of model objects in a simpler way. Let's go step by step. Create an ASP.NET MVC 4 application. First, create two model classes, for example, EmployeeModelClass.cs and DepartmentModelClass.cs inside Model folder in solution.
Model
Several times, we want to post list of model object from view to controller while HttpPost. Many developers try to get the list of data through an array. But I'll tell you without using array also, we can get those list of model objects in a simpler way. Let's go step by step. Create an ASP.NET MVC 4 application. First, create two model classes, for example, EmployeeModelClass.cs and DepartmentModelClass.cs inside Model folder in solution.
Model
public class EmployeeModelClass { public string Name { get; set; } public string Address { get; set; } public string Contact { get; set; } public IEnumerableDeptList { get; set; } } public class DepartmentModelClass { public string DepartmentCode { get; set; } public string DepartmentName
c#
模型
发布
aspnetmvc
控制器
对象
Related Source Codes
No. 186: DX0110- Source code for community propert
0
0
no vote
No. 219: DX0149- Source code for community propert
0
0
no vote
Verification code identification
0
0
no vote
CSV data analysis tool
0
0
no vote
Source code of hospital medical record information
0
0
no vote
No comment