@model DateTime? @{ var attributes = ViewData["htmlAttributes"]; if (attributes == null) { if (ViewBag.Disabled == true) { attributes = new { @class = "form-control", @disabled = "disabled" }; } else { attributes = new { @class = "form-control date" }; } } } @if (ViewBag.Disabled == true) {
@Html.TextBox("", String.Format("{0:d}", (Model.HasValue ? Model.Value.ToShortDateString() : string.Empty)), attributes)
} else {
@Html.TextBox("", String.Format("{0:d}", (Model.HasValue ? Model.Value.ToShortDateString() : string.Empty)), attributes)
}