Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/12/2014, 09:21
daneco1720
 
Fecha de Ingreso: noviembre-2010
Mensajes: 105
Antigüedad: 13 años, 5 meses
Puntos: 0
Exclamación Deshabilitar combo.....

HOLA BUENOS DIAS

TENGO UNA DUD ACERCA DE UN COMBO BOX, MEJOR DICHO UN HTML.DROPDOWNLIST, EL CUAL NECESITO QUE ME TRAIGA EL VALOR QUE LE PIDO, PERO QUE NO PERMITA DESPLEGAR LOS DEMAS ITEMS.

ESTE ES EL CONTROLADOR
Código:
[Authorize]
        public ActionResult Buscar(Evento evento)
        {
            List<Evento> ListaEvent = new List<Evento>();

            IQueryable<Evento> match = db.Evento;

            if (!string.IsNullOrEmpty(evento.Descripcion))
                match = match.Where(u => u.Descripcion.ToLower().Contains(evento.Descripcion.ToLower()));

            if (!string.IsNullOrEmpty(evento.Codigo))
                match = match.Where(u => u.Codigo.ToLower().Contains(evento.Codigo.ToLower()));

            if (evento.Fecha.HasValue)
                match = match.Where(u => u.Fecha == evento.Fecha);



            var qry = from m in match
                      select m;

            if (string.IsNullOrEmpty(evento.Descripcion) && string.IsNullOrEmpty(evento.Codigo) && string.IsNullOrEmpty(evento.Fecha.ToString()))
            {
                ViewBag.ValidationResult = "Debe llenar uno de los campos";
            }
            else
            {
                ListaEvent = qry.ToList();
            }


            return View("Index", ListaEvent.ToList().FirstOrDefault());
        }

ASI LO LLAMO EN EL VIEW O LA VISTA

Código HTML:
<div class="editor-field">
        <%: Html.DropDownList("IdEvento", "Seleccione una Opcion…")%>
   </div>