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

Cannot get grid to perform grouping

1 Answer 35 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 2
Bill asked on 23 Jan 2013, 04:46 PM

I need to convert an SSRS report that I developed into a Telerik grid which does similiar grouping (see attached files).

Notice that in the SSRS rpt, the data is grouped by CruiseLine, Ship, and Date. I want that same kind of grouping (not the look, just the correct grouping) in the Telerk Grid, but cannot achieve that desired result.

I've read articles and searched the web about this topic. I've tried several different things, but I just can't get it to group data on those fields.

The detail data is coming out fine (see attached file "telerik grp") with the correct display in the Group Header.

I don't know where the top line (CruiseLine, Ship, and Date) comes from via my grid. I don't see any properties that would display that. I'm not interested in any sorting, just grouping. btw, when I click on any of those 3, the grid just disappears.

Below, is my code for the grid.

Can somebody please help me achieve what should be, a simple grouping, and point out what I'm doing wrong that needs to be corrected?

<telerik:radgrid id="RadGrid1" runat="server" GridLines="None" AutoGenerateColumns="False" AllowPaging="True" ShowGroupPanel="True"
                        ShowFooter="True" >
                        <PagerStyle Mode="NextPrevNumericAndAdvanced"></PagerStyle>
                        <MasterTableView GroupsDefaultExpanded="false" GroupLoadMode="Client" ShowGroupFooter="True" pagesize="50"
                            ExpandCollapseColumn-Groupable="True">
                            <RowIndicatorColumn Visible="True"
                                <HeaderStyle Width="20px"></HeaderStyle>
                            </RowIndicatorColumn>
                            <ExpandCollapseColumn Visible="True"
                                <HeaderStyle Width="19px"></HeaderStyle>
                            </ExpandCollapseColumn>
                            <Columns>
                                <telerik:GridBoundColumn DataField="CruiseLine" ReadOnly="true">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Ship" ReadOnly="true">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Date" ReadOnly="true" DataFormatString="{0:M/d/yyyy}">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Product1Cash" ReadOnly="true" DataFormatString="{0:C2}">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Product2Cash" ReadOnly="true" DataFormatString="{0:C2}">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Product3Cash" ReadOnly="true" DataFormatString="{0:C2}">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Product4Cash" ReadOnly="true" DataFormatString="{0:C2}">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Product5Cash" ReadOnly="true" DataFormatString="{0:C2}">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Product6Cash" ReadOnly="true" DataFormatString="{0:C2}">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Sales" ReadOnly="true" DataFormatString="{0:C2}">
                                </telerik:GridBoundColumn>
                            </Columns>
                            <GroupByExpressions>
                              <telerik:GridGroupByExpression>
                                <SelectFields>
                                  <telerik:GridGroupByField FieldName="CruiseLine" />
                                  <telerik:GridGroupByField FieldName="Ship" />
                                  <telerik:GridGroupByField FieldName="Date" FormatString="{0:M/d/yyyy}" />
                                </SelectFields>
                                <GroupByFields>
                                  <telerik:GridGroupByField FieldName="CruiseLine" />
                                  <telerik:GridGroupByField FieldName="Ship" />
                                  <telerik:GridGroupByField FieldName="Date" FormatString="{0:M/d/yyyy}" />
                                </GroupByFields>
                              </telerik:GridGroupByExpression>
                            </GroupByExpressions>
                        </MasterTableView>
                    </telerik:radgrid>

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 28 Jan 2013, 12:10 PM
Hello Bill,

In case you need to remove the group panel that represents the group by fields form the top of the grid you could simply set ShowGroupPanel="false" for the RadGrid control. As for the Grid disappearing issue I suppose that you are binding the RadGrid with simple Databinding as I do not see any handlers for the NeedDataSource control or decoratively set DataSource. If this is the case please note that the Grouping feature is not supported with simple data bonding but you should use advanced binding as described below:
 http://www.telerik.com/help/aspnet-ajax/grid-advanced-data-binding.html

Greetings,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Bill
Top achievements
Rank 2
Answers by
Maria Ilieva
Telerik team
Share this question
or