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. Image for the cookie policy date
close icon

DropDownList with item check all

Hi,

I want an element "check all" inside the dropdownlist items.

I've done this:

<ej:DropDownList ID="ddlGrupoOS" runat="server" SelectMethod="GetGruposOS" DataTextField="Nombre" DataValueField="ID" OnDataBinding="ddlEstadoOS_DataBinding" ></ej:DropDownList>

.....

<script>
        function onCheckUncheckAll(args) {
            if (args.value == "0") {
                var sender = $('#<%=ddlGrupoOS.ClientID%>').data("ejDropDownList");
                if (args.isChecked)
                    sender.checkAll();
                else
                    sender.unCheckAll();
            }
        }
<script>

Code Behind

public IEnumerable<GrupoOS> GetGruposOS()
        {
            DMOperaciones db = new DMOperaciones();
            var result = db.GetGruposOS().OrderBy(x => x.ID).ToList();;
            result.Insert(0, new GrupoOS() { ID = 0, Nombre = "Check all" });
            return result;
        }

I need this "property" in a lot of dropdown list. I think that it could be better done, but I don't know

Thanks

1 Reply

KC Kasithangam C Syncfusion Team October 9, 2015 10:36 AM UTC

Hi Manolo,

Currently we don’t have inbuilt functionality for adding check all element in DropDownList items .You can add checkall element in your desire dropdownlist items after achieving this behavior. You could use the code that you have mentioned in your query. We have logged defect report for this. A support incident to track the status of this issue has been created under your account. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents  


Regards,

Kasithangam


Loader.
Live Chat Icon For mobile
Up arrow icon