Hi,
I've a dropdown list with checkBox, similar at this
Class:
public partial class TipoOS
{
public TipoOS()
{
CodigoOS = new HashSet<CodigoOS>();
SubtipoOS = new HashSet<SubtipoOS>();
}
public int ID { get; set; }
[Required]
[StringLength(150)]
public string Nombre { get; set; }
[StringLength(250)]
public string Descripcion { get; set; }
public virtual ICollection<CodigoOS> CodigoOS { get; set; }
public virtual ICollection<SubtipoOS> SubtipoOS { get; set; }
}
View:
@using (Html.BeginForm("CrearInformes","InformeDiario"))
{
<div class="col-md-2">
@Html.EJ().DatePicker("FechaInforme").DateFormat("dd/MM/yyyy").Value("17/07/2015").Locale("es-ES")
</div>
<div class="col-md-2">
@Html.EJ().DropDownList("TipoOperacion").Datasource((IEnumerable<EntitiesInforme.Informe.TipoOS>)ViewBag.DSTiposOperacion).DropDownListFields(ddl => ddl.ID("ID").Text("Nombre").Value("ID")).ShowCheckbox(true)
</div>
<div class="col-md-2">
<button type="submit" class="btn btn-default">Generar Informe</button>
</div>
}
My controller:
public ActionResult CrearInformes(DateTime? fechaInforme, List<object> tipoOperacion)
{
return View();
}
In list "tipoOperacion", I get the Name of selected values, not the ID.
What is wrong?
Thanks