Set dropDownList to contain one value only, mvc3

Posted by ParPar on Stack Overflow See other posts from Stack Overflow or by ParPar
Published on 2011-11-24T09:45:32Z Indexed on 2011/11/24 9:53 UTC
Read the original article Hit count: 270

I have this in my controller:

ViewBag.PriceListId = new SelectList(m_db.PriceLists, "Id", "Name", us.PriceListId);

It contains two values now, but I want to enable the user to choose only the second value, and just if he does something else - allow him choose one of the both values.

How do I omit the first value, and add and set him to default after that? Shoud I do it in my controller or use jquery?

Thank in advance.

© Stack Overflow or respective owner

Related posts about asp.net-mvc-3

Related posts about dropdownlist