我正在尝试将数据库中的日期检索到数据表但我遇到了以下问题。我们将非常感谢您的帮助。
\/Date(1239018869048)\/
控制器:
public ActionResult GetData()
{
List<LeavePeriod> leavindb = _dbContext.LeavePeriod.ToList<LeavePeriod>();
return Json(new { data = leavindb }, JsonRequestBehavior.AllowGet);
}
查看:
@section scripts
{
<script>
var Popup, dataTable;
$(document).ready(function () {
dataTable = $('#leaveperiod').DataTable({
"ajax": {
"url": "/LeaveSetup/GetData",
"type": "GET",
"datatype": "json"
},
"columns": [
//{ "data": "LeavePeriodId" },
{
"data":"StartDate"
},
{ "data": "EndDate" },
{
"data": "LeavePeriodId",
"render": function(data) {
return "<a class='btn btn-default btn-sm' onclick=PopupForm('@Url.Action("AddOrEdit", "LeaveSetup")/" +data +"')><i class='fa fa-pencil'></i> Edit</a>" +"<a class='btn btn-danger btn-sm'style='margin-left:5px;'onclick=Delete(" +data +") ><i class='fa fa-trash'></> Delete</a>";
},
"orderable": false,
"searchable": false,
"width": "120px"
}
]
// ,
// "language": { "emptyTable": "No data found,Please click on <b>Add New</b> Button" }
});
});
function PopupForm(url) {
var formDiv = $('<div/>');
$.get(url)
.done(function (response) {
//start here
//end
formDiv.html(response);
Popup = formDiv.dialog({
autoOpen: true,
resizable: false,
title: 'Fill LeavePeriod Details',
height: 500,
width: 700,
close: function () {
Popup.dialog('destroy').remove();
}
});
});
}
</script>
}