Change Date display format on TextAreafor directly

Viewed 201

I was wondering if there was any way to directly change the format of a date displayed in a TextAreaFor. I know this topic has been asked alot and my problem may seem similar to those two:

MVC DateTime Textbox Formatting Issue

How do you format a DateTime that's displayed by TextBoxFor() in MVC3?

But I will explain why its different. Here's the textarefor :

@Html.TextAreaFor(m => m[i].DateFormation, new { @class = "textArea" })

Like in the questions I linked above, I could put the DisplayFormat attribute on the field but I don't have the right to modify the model or use Metadata

So My question is if there is any way to apply a format to a textareafor like you can do with a textboxfor ?

@Html.TextBoxFor(m => m[i].DateFormation, "{0:yyyy-MM-dd}", new { @class = "textArea" })

I Tried to apply .ToString to my field but it seems like TextAreafor won't accept it

Note : My last case scenario is that I will Have to modify the model content with c# code in view before showing it but that just feels wrong to me and a bad practice to mix my code with the design

1 Answers
Related