This is a migrated thread and some comments may be shown as answers.

Group Header is not showing

3 Answers 58 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 2
Richard asked on 17 Jul 2009, 04:17 PM
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

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 20 Jul 2009, 04:33 AM
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.
0
Jason
Top achievements
Rank 1
answered on 10 Sep 2019, 07:19 PM

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>

 

 

0
Eyup
Telerik team
answered on 13 Sep 2019, 01:15 PM
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.
Tags
Grid
Asked by
Richard
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 1
Jason
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or