发生更新行事件时向服务器发送的日期数据格式错误。对于发送的所有数据,它以“01.01.0001 00:00:00”的形式进入服务器。发送前客户端的行日期数据是(我通过警报看到)“Sat May 05 2012 00:00:00 GMT+0300 (GTB Daylight Time)”。有什么建议吗?
客户端代码是:
var gridSource = {
datatype: "json",
datafields: [{ name: 'KargoId' }, { name: 'Ad' }, { name: 'Soyad' },
{ name: 'YuklenmeTarihi', type: 'date' }, { name: 'Adet' }, { name: 'Fiyat'}],
url: 'BindGrid',
updaterow: function (rowid, rowdata) {
if (selectedUrunId != undefined && selectedUrunId != -1) {
rowdata.UrunId = selectedUrunId;
selectedUrunId = -1;
}
alert(rowdata.YuklenmeTarihi);
var data = $.param(rowdata);
//alert(data);
$.ajax({
dataType: 'json',
url: 'UpdateEditGrid',
data: data,
success: function (data, status, xhr) {
gridDataAdapter.dataBind();
/*if (data.Success == false)
alert(JSON.stringify(data));*/
/*if (data.Success == true && gridDataAdapter != undefined)
gridDataAdapter.dataBind();*/
},
error: function (xhr, status, error) {
alert(JSON.stringify(xhr));
}
});
}
};
var gridDataAdapter = new $.jqx.dataAdapter(gridSource, {
downloadComplete: function (data, status, xhr) { },
loadComplete: function (data) { },
loadError: function (xhr, status, error) { alert(JSON.stringify(xhr)); }
});
// initialize jqxGrid
$("#jqxgrid").jqxGrid(
{
width: 670,
source: gridDataAdapter,
editable: true,
theme: theme,
selectionmode: 'singlecell',
columns: [
{ text: '#', datafield: 'KargoId', width: 40 },
{ text: 'Ad', columntype: 'textbox', datafield: 'Ad', width: 90 },
{ text: 'Soyad', datafield: 'Soyad', columntype: 'textbox', width: 90 },
{ text: 'YuklenmeTarihi', datafield: 'YuklenmeTarihi', columntype: 'datetimeinput', width: 90, cellsalign: 'right', cellsformat: 'd',
validation: function (cell, value) {
var year = value.getFullYear();
if (year >= 2013) {
return { result: false, message: "Yükleme zamanı 1/1/2013 tarihinden önce olmalı!" };
}
return true;
}
},
{ text: 'Adet', datafield: 'Adet', width: 70, cellsalign: 'right', columntype: 'numberinput',
validation: function (cell, value) {
if (value < 1 || value > 15) {
return { result: false, message: "Adet 1-15 aralığında olmalı!" };
}
return true;
},
initeditor: function (row, cellvalue, editor) {
editor.jqxNumberInput({ decimalDigits: 0, digits: 3 });
}
},
{ text: 'Fiyat', datafield: 'Fiyat', width: 65, cellsalign: 'right', cellsformat: 'c2', columntype: 'numberinput',
validation: function (cell, value) {
if (value < 0 || value > 15) {
return { result: false, message: "Fiyat 0-15 aralığında olmalı!" };
}
return true;
},
initeditor: function (row, cellvalue, editor) {
editor.jqxNumberInput({ digits: 3 });
}
}
]
});