how to add a "Please select" to a dropdown box
Posted
by oo
on Stack Overflow
See other posts from Stack Overflow
or by oo
Published on 2010-04-15T19:29:21Z
Indexed on
2010/04/15
19:33 UTC
Read the original article
Hit count: 195
i have the following code in an asp.net mvc view.
<% = Html.DropDownList("Filter", new SelectList(Model.Items, "Id", "Name", 0), new { @id = "Filter", @class = "autoComplete1" })%>
i want to add an element at the top of the dropdown as the first item that says, "Please select".
do i have to add that into my Model.Items or is there a way i can add that element into the view and ignore the selection of that first element ??
© Stack Overflow or respective owner