0

Is there a way to give the please select item a value of 0 or -1?

Thanks

1
  • I don't understand your question. What do you want exactly ? Commented May 20, 2009 at 9:24

1 Answer 1

1

Supposing Model.Services contains list of ServiceType objects you could add an item to the list like this:

<%= 
    Html.DropDownList("ServiceId", new SelectList(
        new [] 
        {
            new ServiceType 
            {
                Id = 0,
                Name = "-- Please Select --"
            }
        }.Union(Model.Services), "Id", "Name"), 0)
%>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.