asp.net mvc How to add placeholder for html.dropdownlist

后端 未结 10 565
眼角桃花
眼角桃花 2021-01-01 23:13

I\'m using asp.net mvc 3.

I have this dropdownlist of countries and I want to add a placeholder for it. Here\'s my code:

@Html.DropDownList(\"country         


        
10条回答
  •  独厮守ぢ
    2021-01-01 23:56

    @Html.DropDownListFor(m => m.SelectedProductIDs, 
    Model.AvaliableProducts.ToSelectList("ID","Name"),
                           new { @class = "chzn-select", 
                                data_placeholder="Please select a product" })...
    

    Please see in more details : http://code.stylenet.ca/mvc3-data-placeholder-html5-attribute/

提交回复
热议问题