I have a text area
<%=Html.TextArea("CDescr", "", new { Class = "textarea1" })%>
I want to set value to this textare from controller. How can I do that ?
I have a text area
<%=Html.TextArea("CDescr", "", new { Class = "textarea1" })%>
I want to set value to this textare from controller. How can I do that ?
Add the value in the Action method to the ViewData:
public ActionResult Index()
{
ViewData["MyValue"] = "Some text";
return View();
}
Then, use the value to set the text:
<%=Html.TextArea("CDescr", ViewData["MyValue"], new { @class = "textarea1" })%>