This question is locked. New answers and comments are not allowed.
I have a DateTime field that doesn't seem to update when I use a TimePicker and the UpdateModel<> method. I get
generic .Net error when I try to do this. The only way is to manually bind with something like:
ol.ModifiedBy = Collection["ArrivalTime"]; Any ideas why?
VIEW<%= Html.Telerik().TimePicker()CONTROLLER
.Name("ArrivalTime")
.Value(Model.ArrivalTime)
.ShowButton(false)
%>
<br /><%: Html.ValidationMessageFor(model => model.ArrivalTime)%> (MVC VALIDATION DOES NOT WORK EITHER!!!)[HttpPost]
public ActionResult Edit_Location(int LocationId, FormCollection collection)
{
Location ol = _db.Locations.First(l => l.LocationId == LocationId);
try
{
UpdateModel<Location>(ol, "", collection.ToValueProvider());
ol.ModifiedBy = CurrentUserName;
ol.ModifiedOn = DateTime.Now;
_db.SaveChanges();
return RedirectToAction("Details_Location", "Location", new { LocationId = ol.LocationId });
}
catch (Exception ex)
{
return PartialView(ol);
}
}