1
Hello
I’m having a problem with an MVC project. My View needs to return Data values to some Text Boxes (from the record selection by a Data Table) so that the user can do the record Edit.
The problem is that the data is not being shown in the correct format. Textboxes show strange strings like this in place:
/Date(1515290400000)/
My Javascript function looks like this:
function GetDepSecById(DepartmentSectionId) {
$.ajax({
url: urlGetDepSecById,
data: { DepartmentSectionId: DepartmentSectionId },
type: 'POST',
success: function (result) {
$('#DepartmentSectionId').val(result.DepartmentSectionId);
$('#ObsoleteDate').val(result.ObsoleteDate);
$('#StartPeriodDate').val(result.StartPeriodDate);
$('#EndPeriodDate').val(result.EndPeriodDate);
DatePickerPadrao($('#ObsoleteDate'));
DatePickerPadrao($('#StartPeriodDate'));
DatePickerPadrao($('#EndPeriodDate'));
}
});
}
The Datapickerpadrao method is what should be responsible for converting Data. It is within another JS in the project:
function DatePickerPadrao(control) {
control.datetimepicker(
{
locale: 'en-US',
format: 'MM/DD/YYYY'
});
}
You can show an example of how the date comes in
result.ObsoleteDate
?– Ricardo Pontual
In the Controller Script of this Jsonresult Getdepsecbyid method, the Obsoletedate returns the data {07/11/2018 13:35:26}. However, in the View Textbox where this value is played this string is shown: /Date(1531326926000)/
– Guilherme Lima