I am not able to set default text for @HTML.TextAreaFor
This is all I tried, but didn’t work, it always shows empty text area
@Html.TextAreaFor(m => m.EmployeeDescription, new { @Text = ViewBag.Model.EmployeeDescription })
@Html.TextAreaFor(m => m.EmployeeDescription, new { @text = ViewBag.Model.EmployeeDescription })
@Html.TextAreaFor(m => m.EmployeeDescription, new { @Value = ViewBag.Model.EmployeeDescription })
@Html.TextAreaFor(m => m.EmployeeDescription, new { @value = ViewBag.Model.EmployeeDescription })
Exactly same thing is working for @Html.TextBoxFor with @Value but not with TextArea 🙁
Can anybody help…
Found the answer, I was doing a silly mistake
Now I replaced my Index method from this
To this
And it worked!
I was doing that in the wrong way earlier. I was assigning my model as a property of ViewBag and was accessing it through ViewBag only in my view and that was my mistake.
When I replaced my code it started working with this only
🙂 🙂
Thanks for all the replies