We have all our date fields in our Oracle DB defined as "Timestamp with Timezone". We use EF and LINQ to hydrate our VM from the DB. The VM gets populated correctly however when I try to bind a DateTimeOffset attribute to DateTimePicker component it fails.
Can you tell me what could I be doing incorrectly. If this is not supported does someone else have any suggestions that I can try.
Here is what I have so far
VM
[DisplayName("Inactivate Date")]public DateTimeOffset? inactivateDate { get; set; }
public DateTimeOffset? activateDate { get; set; }
View Template
DAO
This fails when it has to find to the DateTimePicker component. I tried to bind it to plain old TextBox and it works fine.
What am I missing.
Can you tell me what could I be doing incorrectly. If this is not supported does someone else have any suggestions that I can try.
Here is what I have so far
VM
[DisplayName("Inactivate Date")]
public DateTimeOffset? inactivateDate { get; set; }
[DisplayName("Inactivate Date")]public DateTimeOffset? inactivateDate { get; set; }
public DateTimeOffset? activateDate { get; set; }
[DisplayName("Energizing Date")]
public DateTimeOffset? energizingDate { get; set; }
View Template
<
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
>
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
{
connectivityUnitID = c.CONNECTIVITY_UNIT.CONNECTIVITY_UNIT_ID,
energizingDate = c.CONNECTIVITY_UNIT.ENERGIZING_DATE.Value.DateTime,
activateDate = c.CONNECTIVITY_UNIT.ACTIVATE_DATE.Value.DateTime,
//inactivateDate = c.CONNECTIVITY_UNIT.INACTIVATE_DATE.Value.DateTime,
updateTime = c.CONNECTIVITY_UNIT.UPDATE_TMSTMP
})
.OrderBy(o => o.substationABBR)
.ToList();
This fails when it has to find to the DateTimePicker component. I tried to bind it to plain old TextBox and it works fine.
What am I missing.