Grouping a check box column inside a RadGrid

4 posts, 0 answers
  1. Adnan
    Adnan avatar
    5 posts
    Member since:
    Feb 2015

    Posted 12 Oct 2015 Link to this post

    Hi,

     

    i just need to group a Grid column which in fact is a check box column. It contains only checked/unchecked boxes, and i want to allow them to be grouped. Here is my part of the code. Btw, some time ago, i figured it out, but cant remember now :(

     

    <Columns>
         <telerik:GridTemplateColumn UniqueName="cbDonorUniqueSelect" HeaderText="SelectAll" AllowFiltering="false" Groupable="True" ShowFilterIcon="false" HeaderStyle-Width="30px">
              <HeaderTemplate>
                    <asp:CheckBox ID="cbCheckAllDonors" runat="server" AutoPostBack="True" OnCheckedChanged="cbCheckAllDonors_CheckedChanged" SkinID="" />
              </HeaderTemplate>
              <ItemTemplate>
                     <asp:CheckBox ID="cbSelectDonor" runat="server" OnCheckedChanged="cbSelectDonor_CheckedChange"/>
              </ItemTemplate>
    </telerik:GridTemplateColumn>
    </Columns>​

  2. Adnan
    Adnan avatar
    5 posts
    Member since:
    Feb 2015

    Posted 12 Oct 2015 in reply to Adnan Link to this post

    Sorry, here is the whole part of Grid code...
     
    <telerik:RadGrid ID="gvDonors" runat="server" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" CellSpacing="0" OnSortCommand="gvDonor_SortCommand" OnGroupsChanging="gvDonor_GroupsChanging"
                     OnPageIndexChanged="gvDonor_PageIndexChanged" PageSize="10" OnPreRender="gvDonor_PreRender" ShowGroupPanel="True" OnPageSizeChanged="gvDonor_PageSizeChanged" ShowFooter="True" Skin="Sunset" style="table-layout:fixed;" AutoGenerateColumns="False" GridLines="None" OnNeedDataSource="gvDonor_NeedDataSource">
        <ClientSettings AllowDragToGroup="True" AllowColumnsReorder="True" ReorderColumnsOnClient="True"></ClientSettings>
        <GroupingSettings CaseSensitive="false" />
        <GroupPanel Text="<%$Resources:localization, lblGroupingText%>"></GroupPanel>
        <MasterTableView DataKeyNames="ID" AutoGenerateColumns="False" ClientDataKeyNames="ID" Width="100%">
            <Columns>
                <telerik:GridTemplateColumn UniqueName="cbDonorUniqueSelect" HeaderText="SelectAll"  AllowFiltering="false" Groupable="True" ShowFilterIcon="false" HeaderStyle-Width="30px">
                <HeaderTemplate>
                    <asp:CheckBox ID="cbCheckAllDonors" runat="server" AutoPostBack="True" OnCheckedChanged="cbCheckAllDonors_CheckedChanged" SkinID="" />
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbSelectDonor" runat="server" OnCheckedChanged="cbSelectDonor_CheckedChange"/>
                </ItemTemplate>
                </telerik:GridTemplateColumn>                                                    
                <telerik:GridBoundColumn DataField="ID" FilterControlAltText="Filter ID column" HeaderText="ID" ReadOnly="True" SortExpression="ID" UniqueName="ID" CurrentFilterFunction="EqualTo" AutoPostBackOnFilter="true" ShowFilterIcon="false" HeaderStyle-Width="30px" FilterControlWidth="30px"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Name" FilterControlAltText="Filter Name column" HeaderText="<%$Resources:localization, lblDonorName%>" SortExpression="Name" UniqueName="Name" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" ShowFilterIcon="false" HeaderStyle-Width="150px" FilterControlWidth="145px"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ShortName" FilterControlAltText="Filter ShortName column" HeaderText="<%$Resources:localization, lblShortDonorName%>" SortExpression="ShortName" UniqueName="ShortName" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" ShowFilterIcon="false" HeaderStyle-Width="150px" FilterControlWidth="145px"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Country" FilterControlAltText="Filter Country column" HeaderText="<%$Resources:localization, lblDonorCountry%>" SortExpression="Country" UniqueName="Country" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" ShowFilterIcon="false"  HeaderStyle-Width="200px" FilterControlWidth="230px"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Status" FilterControlAltText="Filter Status column" HeaderText="<%$Resources:localization, lblStatus%>" SortExpression="Status" UniqueName="Status" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" ShowFilterIcon="false"  HeaderStyle-Width="100px" FilterControlWidth="80px"></telerik:GridBoundColumn>
            </Columns>
            <PagerStyle AlwaysVisible="True"/>
        </MasterTableView>
    </telerik:RadGrid>
  3. Adnan
    Adnan avatar
    5 posts
    Member since:
    Feb 2015

    Posted 14 Oct 2015 Link to this post

    UP

    :(

  4. Viktor Tachev
    Admin
    Viktor Tachev avatar
    2357 posts

    Posted 15 Oct 2015 Link to this post

    Hi Adnan,

    In order for RadGrid to group the data it uses the values for a given field in the data source. However, the template column you are trying to group by does not seem to be bound to a data source field. It displays only CheckBoxes. In that case there are no values the grid can use to perform the grouping.

    You can bind the checkbox column to a boolean field in the data source. This way the data can be grouped cased on the value for the field in the data source.

    Regards,
    Viktor Tachev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top