ASP.NET MVC DropDownLists

Is there a way to give please select 0 or -1?

thanks

0


a source to share


1 answer


Suppose Model.Services contains a list of ServiceType objects that you could add to the list like this:



<%= 
    Html.DropDownList("ServiceId", new SelectList(
        new [] 
        {
            new ServiceType 
            {
                Id = 0,
                Name = "-- Please Select --"
            }
        }.Union(Model.Services), "Id", "Name"), 0)
%>

      

+1


a source







All Articles