Add @Html.TextBox value from ViewBag

前端 未结 2 1081
再見小時候
再見小時候 2020-12-31 05:34

Im using MVC 3 asp.net

How can I add an item from ViewBag to html.TextBox like this:

@Html.TextBox(\"txtName\",@ViewBag.Par         


        
2条回答
  •  无人及你
    2020-12-31 05:52

    This will work: @Html.TextBox("txtName",ViewBag.Parameters.Name) assuming that ViewBag.Parameters.Name has a value

    Just to elaborate, you are using @ symbol twice, which doesn't make sense.

    Good luck

提交回复
热议问题