开发者

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" })%>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜