MVC占位符在下拉列表中

时间:2019-03-04 15:59:29

标签: html asp.net-mvc model-view-controller

如何将占位符放入下拉列表?我已经必须搜索,但仍然找不到解决方案。

HTML

<div class="wrap-input100 rs1-wrap-input100 validate-input">
     <span class="label-input100">Room</span>
     @Html.DropDownList("ID_Room", null, htmlAttributes: new { @class = "focus-input100" })
     <span class="focus-input100"></span>
</div>

1 个答案:

答案 0 :(得分:0)

 @Html.DropDownList("ID_Room", null, "placeholder" , new { @class = "focus-input100" })

也。您不需要htmlAttributes。只需拥有new {}就可以了