Fix for Date and Int datatypes having new editors in MVC4

This commit is contained in:
2012-12-17 21:34:53 -05:00
parent f222cef2e5
commit 2bcca06b7e
12 changed files with 60 additions and 14 deletions
+1 -1
View File
@@ -90,7 +90,7 @@
@Html.DisplayNameFor(m => m.Date)
</dt>
<dd>
@Html.DisplayTextFor(m => m.Date)
@Html.Encode(Model.Date.ToShortDateString())
<small class="muted">(@Html.DisplayTextFor(m => m.DateHowLongAgo))</small>
</dd>
</dl>
+2 -2
View File
@@ -10,8 +10,8 @@
<p>
You've successfully created an entry
for <strong>@Html.DisplayTextFor(m => m.EmployeeName)</strong>
traveling to <strong>@Html.DisplayTextFor(m => m.CityName)</strong>
on <strong>@Html.DisplayTextFor(m => m.Date)</strong>
traveling to <strong>@Html.DisplayTextFor(m => m.CityName)</strong>
on <strong>@Html.Encode(Model.Date.ToShortDateString())</strong>
in Vehicle Id <strong>@Html.DisplayTextFor(m => m.VehicleId)</strong>
</p>
<p>
@@ -0,0 +1,5 @@
@model DateTime
@{
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
}
@Html.Encode(string.Format(ViewData.ModelMetadata.DisplayFormatString, Model))
@@ -1,4 +1,11 @@
@{
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
}
@Html.Encode(Model)
@if (Model == null)
{
@Html.Encode(@ViewData.ModelMetadata.NullDisplayText)
}
else
{
@Html.Encode(Model)
}
@@ -0,0 +1,13 @@
@model DateTime
@{
Layout = "~/Views/Shared/EditorTemplates/_FieldLayout.cshtml";
var inputSize = (string)ViewData.ModelMetadata.AdditionalValues["InputSize"];
}
@if (!string.IsNullOrEmpty(inputSize))
{
@Html.TextBox("", (Model != DateTime.MinValue ? Model.ToShortDateString() : string.Empty ), new { @class = inputSize})
}
else
{
@Html.TextBox("", (Model != DateTime.MinValue ? Model.ToShortDateString() : string.Empty ))
}
@@ -1,5 +1,13 @@
@model DateTime
@{
Layout = "~/Views/Shared/EditorTemplates/_FieldLayout.cshtml";
var inputSize = (string)ViewData.ModelMetadata.AdditionalValues["InputSize"];
}
@if (!string.IsNullOrEmpty(inputSize))
{
@Html.TextBox("", (Model != DateTime.MinValue ? Model.ToShortDateString() : string.Empty ), new { @class = inputSize})
}
else
{
@Html.TextBox("", (Model != DateTime.MinValue ? Model.ToShortDateString() : string.Empty ))
}
@Html.TextBox("", (Model != DateTime.MinValue ? Model.ToShortDateString() : string.Empty ))
@@ -0,0 +1,12 @@
@{
Layout = "~/Views/Shared/EditorTemplates/_FieldLayout.cshtml";
var inputSize = (string)ViewData.ModelMetadata.AdditionalValues["InputSize"];
}
@if (!string.IsNullOrEmpty(inputSize))
{
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue, new { @class = inputSize})
}
else
{
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue)
}