I have a Kendo DateTimePicker that is not passing the changed value to the Controller. I just get the original bound value.
Here is the View Code:
@for (var i = 0; i < Model.Call.CallTimeSheets.Count(); i++ )
{
<tr>
<td>@(Html.Kendo().DateTimePickerFor(model => Model.Call.CallTimeSheets[i].StartTime)
.Name("Start" + i.ToString())
.Format("dd-MM-yyyy HH:mm")
</td>
<td>@(Html.Kendo().DateTimePickerFor(model => Model.Call.CallTimeSheets[i].StopTime)
.Name("Stop" + i.ToString())
.Format("dd-MM-yyyy HH:mm")
</td>
</tr>
}
Here is the ViewModel:
public class CallEditViewModel
{
public Call Call { get; set; }
public IEnumerable<SelectListItem> Employees { get; set; }
public IEnumerable<SelectListItem> ClientCallers { get; set; }
public IList<CallTimeSheet> TimeSheet { get; set; }
}
And here is the Model:
[Table("CallTimeSheet")]
public class CallTimeSheet
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid ID { get; set; }
public Guid CallID { get; set; }
[ForeignKey("CallID")]
public virtual Call Call { get; set; }
public Guid? EmployeeID { get; set; }
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MMMMM-dd}")]
[Display(Name = "Start Time")]
public DateTime? StartTime { get; set; }
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MMMMM-dd}")]
[Display(Name = "Start End")]
public DateTime? StopTime { get; set; }
[Timestamp]
public byte[] RowVersion { get; set; }
public TimeSpan? CallDuration()
{
return StopTime - StartTime;
}
}
When the form submits I get no errors but the values in both the start and stop times that are posted to the controller are the original values passed to the view from the controller GET.
There are several other questions similar to this but none of the solutions have worked.