How to set value to text are in MVC
I have a text area
I want to set value to this textare from controller. H开发者_如何学运维ow 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" })%>
精彩评论