We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Can not get selected value in dropdownlist with checkbox

Thread ID:





120121 Sep 2,2015 07:42 AM UTC Sep 3,2015 11:54 AM UTC ASP.NET MVC 1
Tags: DropDownList
Asked On September 2, 2015 07:42 AM UTC


I've a dropdown list with checkBox, similar at this


public partial class TipoOS
        public TipoOS()
            CodigoOS = new HashSet<CodigoOS>();
            SubtipoOS = new HashSet<SubtipoOS>();

        public int ID { get; set; }

        public string Nombre { get; set; }

        public string Descripcion { get; set; }

        public virtual ICollection<CodigoOS> CodigoOS { get; set; }

        public virtual ICollection<SubtipoOS> SubtipoOS { get; set; }

@using (Html.BeginForm("CrearInformes","InformeDiario"))
                <div class="col-md-2">
                <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 class="col-md-2">
                    <button type="submit" class="btn btn-default">Generar Informe</button>

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?


Sasikala Nagarajan [Syncfusion]
Replied On September 3, 2015 11:54 AM UTC


Thanks for contacting Syncfusion support.

We have analyzed your query (able to get name in post back not id) and unable to reproduce the reported issue at our end. In form post back, we are able to get the ID of the selected items since we mapped the data source’s empidfield to dropdown list value fields. Please refer to the below sample prepared based on the provided code.

Sample: http://www.syncfusion.com/downloads/support/forum/120121/autocomplete_(4)-626656692.zip

In this sample, we have mapped theempidfield of local data source to dropdown list value field (member of DropDownList fields’ property). In form post back we can get the selected item’s id.

Please refer to the below code example:

@Html.EJ().DropDownList("TipoOperacion").Datasource((IEnumerable<object>)ViewBag.datasource).DropDownListFields(ddl => ddl.ID("empid").Text("firstname").Value("empid")).ShowCheckbox(true)

If you are still facing the problem, please revert us with issue reproduced sample that will be helpful for us to analyze further and provide solution.


Sasikala Nagarajan


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon