I have an html.TextArea helper that I’d like to set a default.
@Html.TextAreaFor(model => model.CompletionCriteria,
new { rows = 5, cols = 70, @class = "celltext2",
@Value = ViewBag.CompletionCriteria,
@Text = ViewBag.CompletionCriteria })
The controller is setting the ViewBag.CompletionCriteria variable by querying the DBContext to get the default vaule for this given TextArea. The TextArea Value and Text properties are being set correctly, so the ViewBag is good, however the data doesn’t display in the TextArea. I’m sure I’m just missing a property setting. Any ideas?
Remove the @Value and @Text attributes. It will automatically populate it, assuming it’s set correctly and you’re not using a strongly typed model. make sure it’s spelled correctly in both your View and Controller.