[CLOSED] Checkboxes in CheckBoxGroup

  1. #1

    [CLOSED] Checkboxes in CheckBoxGroup

    Hi all,

    a very simple task I can't solve. I need a "select/deselect all" fn.
    How do you retrieve checkboxes (and their values) from a CheckBoxGroup?
    I saw example Form -> Group that does it via server side, how can I do it client side?

    How about RadioGroup? Should be the same.

    Thanx

    Matteo
  2. #2

    RE: [CLOSED] Checkboxes in CheckBoxGroup

    Hi Matteo,

    Please see the following sample
    <%@ Page Language="C#" %>
    <%@ Import Namespace="System.Collections.Generic"%>
    <%@ Import Namespace="System.Xml"%>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title></title>
        
        <script type="text/javascript">
            function setSelection(group, value) {
                for (var i = 0, len = group.items.length; i < len; i++) {
                    group.items.get(i).setValue(value); 
                }
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ScriptManager ID="ScriptManager1" runat="server">
            </ext:ScriptManager>
            
            <ext:CheckboxGroup ID="Group1" runat="server" Vertical="true" ColumnsNumber="1">
                <Items>
                    <ext:Checkbox runat="server"></ext:Checkbox>
                    <ext:Checkbox runat="server"></ext:Checkbox>
                    <ext:Checkbox runat="server"></ext:Checkbox>
                    <ext:Checkbox runat="server"></ext:Checkbox>
                    <ext:Checkbox runat="server"></ext:Checkbox>
                </Items>
            </ext:CheckboxGroup>
            
            <ext:Button runat="server" Text="Select All">
                <Listeners>
                    <Click Handler="setSelection(#{Group1}, true);" />
                </Listeners>
            </ext:Button>
            
            <ext:Button ID="Button1" runat="server" Text="Clear All">
                <Listeners>
                    <Click Handler="setSelection(#{Group1}, false);" />
                </Listeners>
            </ext:Button>
            
            
        </form>
    </body>
    </html>

  3. #3

    RE: [CLOSED] Checkboxes in CheckBoxGroup

    Hi Vlad,

    thanx, it works fine.

    Matteo

Similar Threads

  1. Replies: 4
    Last Post: Nov 02, 2012, 7:46 AM
  2. [CLOSED] CheckboxGroup, adding checkboxes dynamically and viewstate
    By Edward in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Mar 09, 2011, 6:43 PM
  3. [CLOSED] Treepanel Checkboxes
    By dheeraj_us in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Aug 12, 2010, 6:59 PM
  4. Tooltips not working for checkboxes
    By principal_X in forum 1.x Help
    Replies: 7
    Last Post: Feb 22, 2010, 12:25 PM
  5. [CLOSED] Custom search with checkboxes
    By jchau in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 24, 2009, 8:28 PM

Posting Permissions