This is a migrated thread and some comments may be shown as answers.

Post Grid Along with Other Form Data Failes

1 Answer 52 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shahzad
Top achievements
Rank 1
Shahzad asked on 17 Jan 2014, 11:35 AM
Kendo UI Complete ASP.NET  Verison : 2013.3.1316 
download the code library  from peter post
add the datetime field in the mode


this code library post everything except datetime field.. please help

dattime filed always remians= 01/01/0001 if you change it from datepicker and then post the form to the controller



--------DateTime Filed PostBack value stays 01/01/0001 Issue-------------------

This approach does not work any more with new kendo contorls library i do'nt know if its works for the previous verions.

if you have datetime filed in your model

Model
{
 public string UserName { get; set; }
 public string UserPhone { get; set; }
 public datetime workDate { get; set; }      <--this will be 01/01/0001 or Null on postback
}

when you do this your view

 columns.Bound(item => item.workDate ).Title("Wok Date").Encoded(true).ClientTemplate("#= WorkDate #" +
                                        "<input type='hidden' name='gridItems[#= index(data) #].WorkDate' value='#= WorkDate #' />");


  <input type="submit" value="Save" id="save"/>


Fails on Postback
CreateWorkOrder(WorkOrderContainer model)
{
 var mydate =model.workDate;   <---- your mydate will be 01/01/0001 Or  null always
}

please help any one or if there is other approch to post the data to server where new entry will be made on action result

regards
Shahzad ilyas


1 Answer, 1 is accepted

Sort by
0
Accepted
Shahzad
Top achievements
Rank 1
answered on 19 Jan 2014, 03:29 PM
/refresh Grid before save           
            $("#save").click(function (e) {
                debugger;
                $("#WorkOrderDetails").data("kendoGrid").dataSource.read();
                $("#WorkOrderDetails").data("kendoGrid").refresh();
            });
Tags
Grid
Asked by
Shahzad
Top achievements
Rank 1
Answers by
Shahzad
Top achievements
Rank 1
Share this question
or