Hi,
I have a grid which has two datetime columns. I am makin my own POST request to the controller and I am sending the 'alltransactions' like this :
var transaction = $("#myCurrencyGrid").igGrid("allTransactions");
$.ajax({ type: "POST", url: "/GeneralLedger/CreateCurrency", data: JSON.stringify({ 'myModel': myModel, 'transaction': transaction }), success: function (data) { .. }, dataType: "json", traditional: true, contentType: "application/json; charset=utf-8" });
In my controller I am getting (01/01/0001 00:00:00) (null datetime) in my grid transaction model although I had selected a valid date from the grids datepicker. Why am I getting null Date in my controller in igtransaction's row property?
In my grid I have setup the columns like this :
.Updating() cs.ColumnSetting().ColumnKey("cur_rt_from_dt").EditorType(ColumnEditorType.DatePicker); cs.ColumnSetting().ColumnKey("cur_rt_to_dt").EditorType(ColumnEditorType.DatePicker);
.Columns()
column.For(x => x.cur_rt_from_dt).HeaderText("From Date").DataType("date").Format("ddd, MMM-d-yy HH:mm"); column.For(x => x.cur_rt_to_dt).HeaderText("To Date").DataType("date").Format("ddd, MMM-d-yy HH:mm");
I console.logged the JSON.stringified() transaction on my submit button click and here is the output:
CONSOLE.LOG : "Stringified transaction: [{"type":"newrow","tid":"447b","row":{"cur_rt_pk":6,"cur_rt_from_dt":"/Date(1411066800000)/","cur_rt_to_dt":"/Date(1411153200000)/","cur_rt_buying_rate":66,"cur_rt_selling_rate":67},"rowId":6}]"
If the '/Date(......)/' are valid dates why am I getting (01/01/0001 00:00:00) in my controller. I just want to point out that I am sending these transactions after JSON.stringify(transaction) and in the console log I can see a differenct /Date(....)/ for every different date so uptil JSON.Stringify function the date is ok ( I think ) . I am using Asp.net MVC & IgniteUI version 4.13.2.2157 . I tried enabling enable Utc date to true and false also, nothing changes. I still get a bogus null date in my controller.
hello ,
I am using igDatePicker in Html.Infragistics().Grid()
1. column.For(x => x.Col1).HeaderText("Col1").Width(colWidth).DataType("date").Format(dateformat).Hidden(false).HeaderCssClass("GridHeader");
2. settings.ColumnSetting().ColumnKey("Col1").AllowFiltering(true).FilterCondition("startsWith");
3. .ColumnSettings(cs =>
{
cs.columnSetting().ColumnKey("Col1").EditorType(ColumnEditorType.DatePicker).Required(true).Validation(true);
}
4. .AddClientEvent("editCellStarting", "editCellStarting");
5
function editCellStartingEvent(evt, ui) {
var endDate = grid.igGridUpdating("editorForKey", "Col8");
$($endDate.igEditorFilter("option", "provider").editor.element).data("igDatePicker").options.minValue = ui.newValue;
)
6. grid.on("iggridupdatingdatadirty", function (event, ui) {
grid.igGrid("commit");
return false;
});
6. grid.igGrid("saveChanges", function saveSuccess(data) {}
on serve side i am not getting the correct formate of date. date is comming in "/Date(1510733103000)/"
that formate.
also error "This option can not be set runtime" showing while loading the Grid
I am using igDatePicker in Html.Infragistics().Grid<MyModel>()
Hello Zep,
I am glad I have managed to help you resolving this.
If you need any further assistance do not hesitate to contact me.
Just implemented it. Working perfectly. Thanks again.
Thanks alot Denis, I have not yet ran the sample but I think this will solve it. I will get back to you after implementing it tomorrow morning. Thanks for your help. Really appreciate it.