I have a view model with a property Value
. No matter what I set that property to in an http Post, the text area is rendered empty.
In the ActionResult:
model.Value = "OVERRIDE EVERYTHING AND THIS IS THE VALUE";
return View(model);
In the View (.cshtml):
@switch (Model.Type.name)
{
case "Content":
@Html.TextAreaFor(m => m.Value, htmlAttributes: new { @class = "form-control content-input ckeditor", id = "content" })
break;
}
If I use breakpoints, I can tell that Model.Value
in the switch case has the value set. I can also dump the value on the page with @Model.Value
, but the line for generating the TextArea never displays the text "OVERRIDE EVERYTHING AND THIS IS THE VALUE" that I would expect.
Thanks in advance,
Edit: I believe this answer on StackOverflow is relevant. https://stackoverflow.com/a/707601/4067801