C# 为什么找不到无参数构造函数?
我正在尝试将页面列表返回到我的Post action 我的班级C# 为什么找不到无参数构造函数?,c#,asp.net-mvc-3,razor,C#,Asp.net Mvc 3,Razor,我正在尝试将页面列表返回到我的Post action 我的班级 public class TrackerModel { public int Id { get; set; } public string EquipmentID { get; set; } public string EquipmentDescription { get; set; } [DisplayFormat(DataFormatString = "{0:d}", ApplyForma
public class TrackerModel
{
public int Id { get; set; }
public string EquipmentID { get; set; }
public string EquipmentDescription { get; set; }
[DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true)]
public DateTime? ExpectedReturnedToCustomer { get; set; }
[DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true)]
public DateTime? DateOfCalibration { get; set; }
[DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true)]
public DateTime? NextDueDate { get; set; }
public bool StatusChange { get; set; } //01/07/2014
public string Status { get; set; }
public string CustomerName { get; set; }
public PagedList<TrackerModel> pagedList { get; set; }
public TrackerModel() { }
}
在我看来,参考文献。
注意,这是索引视图中使用的部分视图,我正在表单提交中使用Post Index操作,因此模型将通过Post Index操作
@model IPagedList<TrackerModel>
我的Get行动的回报
var customerViewList = Mapper.Map<IList<Calibration>, IList<TrackerModel>>(calibrationList);
IPagedList<TrackerModel> pagedList = customerViewList.ToPagedList(filter.Page, filter.PageSize, totalRecords);
return PartialView("AllCalibrations", pagedList);
到目前为止我的帖子
[HttpPost]
public ActionResult Index(IPrincipal user, PagedList<TrackerModel> model)
遇到错误
没有为此对象定义无参数构造函数
我想,公共页面列表页面列表{get;set;}
或者public TrackerModel{}会处理这个问题,但不幸的是没有。
感谢您的帮助 PagedList是否有无参数构造函数?Tracker类中的公共PagedList PagedList{get;set;},这不包括它吗?错误是否指向控制器?调试异常时,异常从何而来?