In MVC Razor view, I am trying to format a DateTime field to display time only. Using below code I am getting error \"Templates can be used only with field access, property acce
Instead of TextBoxFor use TextBox and specify the format in the value field i.e.
@Html.TextBox("textboxName", Model.dateName.ToString("MMM dd yyyy"))
Using bootstrap datepicker this would look like:
@Html.TextBox("closeDate", Model.closeDate.ToString("MMM dd yyyy"), new { @class = "form-control", @readonly = "readonly", size = "16", placeholder = Lang.Label_closeDate })