Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
595
Null datetime (01/01/0001 00:00:00) in igTransactions ( GridTransaction<myModel> )
posted

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.