I have a reusable view for displaying project information in a handful of places. In two places, I use this view to update a model and send it to the server for processing. I'm seeing some strange formatting issue with the DatetimePicker when the same view is used on different pages (see attached screenshots). I don't explicitly apply a format string to the Datepicker, but even having done so it doesn't make a difference. If I edit the value, the format gets applied, but on load it is incorrect. Both of the views are being called slightly different from my controller, but return the same partial with the same model:
The GoodDatepickerFormat image comes from result of UpdateViewForProjectDocumentGuid and the BadDatepickerFormat comes from UpdateView, Everything looks the same in both cases (other than UpdateView returning the DateTimes in question with a Kind of Local rather than Unspecified), and I attempted to read it exactly the same as the working case but that made no difference. Is there any workaround to force format on the field?
[HttpPost]
public
ActionResult UpdateView(Project project)
{
var pipelineProject = project;
ViewBag.IsUpdate =
true
;
return
PartialView(
"_CreateUpdateProject"
, pipelineProject);
}
[HttpPost]
public
ActionResult UpdateViewForProjectDocumentGuid(
string
projectDocumentGuid)
{
var projectRepository =
new
ProjectRepository(SystemConnection, CurrentUser, WebConfigHelper.GetConfigurationValue(
"DefaultProgram"
));
var pipelineProject = projectRepository.Read(
new
ProjectSearchModel() { AccountNames = AccessibleProjects.Select(a => a.ProjectAccountName).ToList(), DocumentGuid = projectDocumentGuid}).First();
ViewBag.IsUpdate =
true
;
ViewBag.CollapseGeneral =
true
;
return
PartialView(
"_CreateUpdateProject"
, pipelineProject);
}
The GoodDatepickerFormat image comes from result of UpdateViewForProjectDocumentGuid and the BadDatepickerFormat comes from UpdateView, Everything looks the same in both cases (other than UpdateView returning the DateTimes in question with a Kind of Local rather than Unspecified), and I attempted to read it exactly the same as the working case but that made no difference. Is there any workaround to force format on the field?