Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
500
How to select all items in a multi select web dropdown
posted

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. 

Parents
No Data
Reply
  • 29417
    Verified Answer
    Offline posted

    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://ko.infragistics.com/support

     

    Wdd_multiselect.zip
Children