【发布时间】:2021-05-03 12:58:02
【问题描述】:
我对 ASP .Net MVC 有点陌生,但仍处于学习模式。离开控制器后出现此错误。试图在这个论坛上找到解决方案,但不幸的是他们都没有帮助。 我的代码如下:
型号:
namespace TestHRMS3SIS.Models
{
using System;
using System.Collections.Generic;
public partial class T11922H01
{
public int PMITHUniqueId { get; set; }
public string PMITHIncomeId { get; set; }
public string PMITHIncomeIdK { get; set; }
public string PMITHDesc1 { get; set; }
public string PMITHDesc2 { get; set; }
public bool PMITHIsTaxable { get; set; }
public string PMITHRuleId { get; set; }
public Nullable<decimal> PMITHRentExemptPercent { get; set; }
public Nullable<decimal> PMITHRentCityPercent { get; set; }
public string PMITHIncomeCycle { get; set; }
public byte PMITHPrintingSeq { get; set; }
public string PMITHRoundingStrategy { get; set; }
public Nullable<int> PMITHBICode { get; set; }
public string PMITHBIDesc { get; set; }
public int PMITHMarkForDeletion { get; set; }
public string PMITHUser { get; set; }
public System.DateTime PMITHDateTime { get; set; }
public virtual T11922F01 T11922F01 { get; set; }
}
}
查看
@{
ViewBag.Title = "Income List";
}
<h2>Income List New</h2>
<table id="incomeDataTable">
<thead>enter code here
<tr>
<th>IncomeId</th>
<th>Dsc1</th>
<th>Desc2</th>
<th>RuleId</th>
</tr>
</thead>
</table>
<link href="//cdn.datatables.net/1.10.24/css/jquery.dataTables.min.css" rel="stylesheet" />
@section scripts
{
<script src="//cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js"></script>
<script>
$(document).ready(function () {
$("#incomeDataTable").DataTable(
{
"processing": true,
"serverSide": true,
"ajax": {
"url": "/DataTableTest/GetIncomeList",
"type": "GET",
"datatype": "json"
},
"columns": [
{ "data": "PMITHIncomeId" },
{ "data": "PMITHDesc1" },
{ "data": "PMITHDesc2" },
{ "data": "PMITHRuleId" }
]
});
});
</script>
}
控制器
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TestHRMS3SIS.Models;
namespace TestHRMS3SIS.Controllers.DataTableTest
{
public class DataTableTestController : Controller
{
// GET: DataTable
public ActionResult Index()
{
return View();
}
public ActionResult GetIncomeList()
{
using (Entities3SIS oDbConnection = new Entities3SIS())
{
var oT11922H01 = oDbConnection.T11922H01.ToList<T11922H01>();
return Json(new { data = oT11922H01 }, JsonRequestBehavior.AllowGet);
}
}
}
}
我在控制器中设置了一个断点,并观察到在返回语句中我收到了这个错误。
感谢任何帮助。
【问题讨论】:
标签: asp.net-mvc asp.net-core datatable