I have 3 date attributes defined as timestamp with timezone in Oracle database. I ise EF 5.0 and LINQ to get the data from Oracle and it works fine. I have defined the attributes in my VM As DateTimeOffset and I can populate them without any issues. However when I try to bind them to DateTimePicker in my EditorTemplate it breaks and crashes the page.
Is this not supported? If so what alternatives do I have. Does anyone have an example that I can see.
I am doing a basic MVC app using EF 5.0 and using LINQ to get the data using repository patter.
Here is a snippet of my code.
VM
DAO
View EditorTemplate
Am I missing anything? Is there another or better way of doing this?
Thanks for the help.
Is this not supported? If so what alternatives do I have. Does anyone have an example that I can see.
I am doing a basic MVC app using EF 5.0 and using LINQ to get the data using repository patter.
Here is a snippet of my code.
VM
[DisplayName("Activate Date")]public DateTimeOffset? activateDate { get; set; }[DisplayName("Inactivate Date")]public DateTimeOffset? inactivateDate { get; set; }[DisplayName("Energizing Date")]public DateTimeOffset? energizingDate { get; set; }DAO
var x = dao.CONNECTIVITY_UNIT .Join(dao.OP_AREA_ORG, cu => cu.OP_AREA_CODE, oa => oa.OP_AREA_CODE, (cu, oa) => new { CONNECTIVITY_UNIT = cu, OP_AREA_ORG = oa }) .Where(w => w.CONNECTIVITY_UNIT.UNIT_TYPE.Equals("SUBSTATION")) .Where(w => w.CONNECTIVITY_UNIT.IS_ACTIVE_FLAG.ToUpper().Equals("Y")) .Where(w => w.CONNECTIVITY_UNIT.ABBR.ToUpper().Equals("BRA")) .Select(c => new SubstationVM { energizingDate = c.CONNECTIVITY_UNIT.ENERGIZING_DATE, activateDate = c.CONNECTIVITY_UNIT.ACTIVATE_DATE, inactivateDate = c.CONNECTIVITY_UNIT.INACTIVATE_DATE, updateTime = c.CONNECTIVITY_UNIT.UPDATE_TMSTMP }) .OrderBy(o => o.substationABBR) .ToList();return x;View EditorTemplate
<div class="form-group"> @Html.LabelFor(model => model.energizingDate, new { @class = "control-label col-xs-2" }) <div class="col-xs-2"> @Html.EditorFor(model => model.energizingDate) @Html.ValidationMessageFor(model => model.energizingDate) </div> <div class="col-xs-3"> <div class="form-group"> @Html.LabelFor(model => model.activateDate, new { @class = "control-label col-xs-4" }) <div class="col-xs-7"> @Html.EditorFor(model => model.activateDate) @Html.ValidationMessageFor(model => model.activateDate) </div> </div> </div> <div class="col-xs-3"> <div class="form-group"> @Html.LabelFor(model => model.inactivateDate, new { @class = "control-label col-xs-4" }) <div class="col-xs-7"> @Html.EditorFor(model => model.inactivateDate) @Html.ValidationMessageFor(model => model.inactivateDate) </div> </div> </div></div>Am I missing anything? Is there another or better way of doing this?
Thanks for the help.