Group Header is not showing

4 posts, 0 answers
  1. Richard
    Richard avatar
    43 posts
    Member since:
    Oct 2007

    Posted 17 Jul 2009 Link to this post

    Hi
    I am using in-line <GroupByExpression> and it is working well apart from the fact that I can't get the Group Header to show up.

    The code I am using is below:

       <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" GridLines="None">  
            <HeaderContextMenu CausesValidation="False">  
                <CollapseAnimation Duration="200" Type="OutQuint" /> 
            </HeaderContextMenu> 
            <MasterTableView GroupLoadMode="Client">  
                    <Columns> 
                    <telerik:GridBoundColumn  datafield="ThreadID" datatype="System.Int32" headertext="ThreadID" 
                        sortexpression="ThreadID" uniquename="ThreadID" readonly="True" visible="False">  
                     </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn  datafield="Title" datatype="System.Int32" headertext="Title" 
                        sortexpression="Title" uniquename="Title" readonly="True">  
                     </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn  datafield="Type" datatype="System.Int32" headertext="Type" 
                        sortexpression="Type" uniquename="Type" readonly="True">  
                     </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn  datafield="Publish" datatype="System.Int32" headertext="Publish" 
                        sortexpression="Publish" uniquename="Publish" readonly="True" visible="False">  
                     </telerik:GridBoundColumn> 
                       </Columns> 
                <GroupByExpressions> 
                    <telerik:GridGroupByExpression> 
                        <GroupByFields> 
                            <telerik:GridGroupByField FieldAlias="Type" FieldName="Type" FormatString="" HeaderText="Type" /> 
                        </GroupByFields> 
                    </telerik:GridGroupByExpression> 
                </GroupByExpressions> 
            </MasterTableView> 
            <FilterMenu> 
                <CollapseAnimation Duration="200" Type="OutQuint" /> 
            </FilterMenu> 
            <ValidationSettings EnableValidation="False" /> 
        </telerik:RadGrid> 

    Any help appreciated.

    Thanks
    R
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 19 Jul 2009 Link to this post

    Hello Richard,

    The SelectFields collection determines the information that is displayed in the group header. So inorder to display the GroupHeader you would have to set the GridGroupByExpression>SelectFields as shown below:
    aspx:
    <GroupByExpressions> 
        <telerik:GridGroupByExpression> 
             <GroupByFields> 
                    <telerik:GridGroupByField FieldAlias="Type" FieldName="Type" FormatString="" HeaderText="Type"/>               
             </GroupByFields> 
             <SelectFields> 
                   <telerik:GridGroupByField FieldAlias="Type" FieldName="Type"/>               
             </SelectFields> 
        </telerik:GridGroupByExpression> 
    </GroupByExpressions> 

    Thanks
    Princy.
  3. Jason
    Jason avatar
    3 posts
    Member since:
    Sep 2016

    Posted 10 Sep Link to this post

    Hi Princy,

    I have a similiar issue, i have four categories groups.  I see the headertext and totals for the first two.  the 3rd and 4th group i cannot see the title.   I am worried that its not summing the groupbyexpression because total is always 0, but it should be (2) and (2).  I will paste my radgrid code below.

    <telerik:RadGrid RenderMode="Lightweight" ID="RadGrid2" runat="server" PageSize="30" AutoGenerateColumns="False"
                    AllowPaging="True" CellSpacing="0"
                     GridLines="None"
                      PagerStyle-AlwaysVisible="True"
                      PagerStyle-Position="TopAndBottom"  ResolvedRenderMode="Classic"
                 AllowMultiRowSelection="false" ShowGroupPanel="false"
                OnNeedDataSource="RadGrid2_NeedDataSource" Skin="Sunset" ShowFooter="false">
                <PagerStyle Mode="Slider"></PagerStyle>
                 <MasterTableView CommandItemDisplay="Top" Caption="Training Plan Completion Report"
                   DataKeyNames="course_pk" OverrideDataSourceControlSorting="True" Font-Names="Verdana" Font-Size="8">
                    <CommandItemSettings ShowAddNewRecordButton="false" />
                    
                     <GroupByExpressions>
                         <telerik:GridGroupByExpression>
                             <SelectFields>
                                 <telerik:GridGroupByField FieldAlias="course" FieldName="course" HeaderText="COURSE"></telerik:GridGroupByField>
                                 <telerik:GridGroupByField FieldName="role_count" HeaderText="Total" Aggregate="Sum"></telerik:GridGroupByField>
                             </SelectFields>
                             <GroupByFields>
                                 <telerik:GridGroupByField FieldName="course"></telerik:GridGroupByField>
                             </GroupByFields>
                         </telerik:GridGroupByExpression>
                          <telerik:GridGroupByExpression>
                            <SelectFields>
                                <telerik:GridGroupByField FieldAlias="region" FieldName="region" HeaderText="SERVICE AREA"></telerik:GridGroupByField>
                                <telerik:GridGroupByField FieldName="role_count" HeaderText="Total" Aggregate="Sum"></telerik:GridGroupByField>
                            </SelectFields>
                             <GroupByFields>
                                <telerik:GridGroupByField FieldName="region"></telerik:GridGroupByField>
                            </GroupByFields>
                        </telerik:GridGroupByExpression>
                         <telerik:GridGroupByExpression>
                            <SelectFields>
                                <telerik:GridGroupByField FieldAlias="office" FieldName="office" HeaderText="GASDGASDFASD"></telerik:GridGroupByField>
                                <telerik:GridGroupByField FieldName="role_count" HeaderText="Total" Aggregate="Sum"></telerik:GridGroupByField>
                            </SelectFields>
                            <GroupByFields>
                                <telerik:GridGroupByField FieldName="office"></telerik:GridGroupByField>
                            </GroupByFields>
                        </telerik:GridGroupByExpression>
                      <telerik:GridGroupByExpression>
                            <SelectFields>
                                <telerik:GridGroupByField FieldAlias="role" FieldName="role" HeaderText="SDFSDFSDFSD"></telerik:GridGroupByField>
                                <telerik:GridGroupByField FieldName="role_count" HeaderText="Total" Aggregate="Sum"></telerik:GridGroupByField>
                            </SelectFields>
                            <GroupByFields>
                                <telerik:GridGroupByField FieldName="role"></telerik:GridGroupByField>
                            </GroupByFields>
                        </telerik:GridGroupByExpression>
                    </GroupByExpressions>
                    <Columns>
     
                        <telerik:GridBoundColumn DataField="course"
                                FilterControlAltText="Filter course column" HeaderText="COURSE"
                                SortExpression="course" UniqueName="course">
                        </telerik:GridBoundColumn>
     
                     <telerik:GridBoundColumn DataField="region"
                                FilterControlAltText="Filter region column" HeaderText="SERVICE AREA"
                                SortExpression="region" UniqueName="region" ItemStyle-HorizontalAlign="Left">
                        </telerik:GridBoundColumn>
     
                             <telerik:GridBoundColumn DataField="office"
                                FilterControlAltText="Filter office column" HeaderText="OFFICE"
                                SortExpression="office" UniqueName="office" ItemStyle-HorizontalAlign="Left">
                        </telerik:GridBoundColumn>
                      
     
                        <telerik:GridBoundColumn DataField="role"
                                FilterControlAltText="Filter role column" HeaderText="JOB TITLE"
                                SortExpression="role" UniqueName="role" ItemStyle-HorizontalAlign="Right">
                        </telerik:GridBoundColumn>
     
                          <telerik:GridBoundColumn DataField="completepercent"
                                FilterControlAltText="Filter completepercent column" HeaderText="COMPLETED"
                                SortExpression="completepercent" UniqueName="completepercent" ItemStyle-HorizontalAlign="Left">
                        </telerik:GridBoundColumn>
                    </Columns>
                </MasterTableView>
                <GroupingSettings ShowUnGroupButton="true"></GroupingSettings>
            </telerik:RadGrid>

     

     

  4. Eyup
    Admin
    Eyup avatar
    3818 posts

    Posted 13 Sep Link to this post

    Hello Jason,

    This probably happens because one or more items in this group hold null values for these specified fields. You can resolve it using the following property:
    <MasterTableView ... EnableLinqGrouping="false">

    That should do the trick.

    Regards,
    Eyup
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top