Is this possible? I have the following in my cshtml (razor) MVC 4:
@Html.DropDownListFor(v => v.Medico, ((IEnumerable<SelectListItem>)ViewBag.Medicos), new { @class="span4"})
This is on controller, how I generate the list:
List<Medico> list = null;
Medico medico = null;
if (visitador != null){
list = new List<Medico>(visitador.Medicos.OrderBy( m => m.Nombre));
for (int i = 0; i < list.Count(); i++)
{
var item = list[i];
if (i == 0 && medico == null) medico = list[i];
medicosList.Add(new SelectListItem { Text = item.Nombre + " " + item.Apellido, Value = item.Id.ToString()});
I need to mark somehow in the dropdownlist which "Medico" meets X condition. How can I achieve it? I have a bool method to check the condition which can be called from controller, but after googling a lot I have no idea how to "mark" these.