Skip to content

Infragistics Community Forum / Web / Ultimate UI for ASP.NET Web Forms / How to select all items in a multi select web dropdown

How to select all items in a multi select web dropdown

New Discussion
kissthecook
kissthecook asked on May 27, 2020 2:59 PM

Hi,

I have a webdropdown with EnableMuiltipleSelection = True. The webdropdown is bound to a SQL datasource. I am not using lazy loading.

 How can I select all items listed in the drop down? Is there a property I can set to enable the user to select all items or do I need to add an additional item to the drop  called "All" in my code behind? How would I do that in VB please?

 

 

 

<

 

 

ig:WebDropDown ID="wddEmpDept" runat="server" Width="230px" EnableClosingDropDownOnSelect="False" EnableMultipleSelection="True"TextField="DeptName" ValueField="DeptID" DataSourceID="sdsDepartment" ></ig:WebDropDown>

Thank you. 

Sign In to post a reply

Replies

  • 0
    Maya Kirova
    Maya Kirova answered on Feb 28, 2012 5:01 PM

    Hello,

     

    Thank you for posting in our forum.

     

    Select all functionality is currently not an available feature but you can manually implement this   by following these steps:

    1.       Create a header template with a check box inside.

     

      <HeaderTemplate>

                    <input type="checkbox" id="chkBox" onchange="return CheckChanged(event);" />

                    Select All

                </HeaderTemplate>

     

    2.In the onChange client side event  manually select and deselect all item and set the corresponding values in the input box.

     

    function CheckChanged(e) {

                var value="";

                var wdd = $find("WebDropDown1");

                for (var i = 0; i < wdd.get_items().getLength(); i++) {

     

                    if (e.target.checked) {

                     value+= wdd.get_items().getItem(i).get_text()+", ";

                        wdd.get_items().getItem(i).select(false);

                    }

                    else {

                        wdd.get_items().getItem(i).unselect(false);

                    }

               

                }

     

                wdd.set_currentValue(value,true);

                wdd.closeDropDown();

            }

     

    Please refer to the attached sample and let me know if you have any questions or concerns regarding this.

     

    Best Regards,

    Maya Kirova

    Developer Support Engineer

    Infragistics, Inc.

    http://www.infragistics.com/support

     

    • 0
      kissthecook
      kissthecook answered on Feb 28, 2012 6:42 PM

      Thank you, this looks like it will work for me.

    • 0
      Michael
      Michael answered on Mar 27, 2012 6:49 PM

      Where in the documentation is "set_currentValue) explained?

    • 0
      Roopa AS
      Roopa AS answered on Jul 16, 2013 11:02 AM

      Hi maya,

      how to style the "select all"  text of  input type as like other drop down items..

       

      Regards,

      Roopa

    • 0
      Hemant Mainkar
      Hemant Mainkar answered on May 27, 2020 2:59 PM

      I am getting "unable to get property 'get_items' of undefined or null reference" error. Please advice.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
kissthecook
Favorites
0
Replies
5
Created On
May 27, 2020
Last Post
6 years ago

Suggested Discussions

Created by

Created on

May 27, 2020 2:59 PM

Last activity on

May 27, 2020 2:59 PM