This is a migrated thread and some comments may be shown as answers.
Group Header Aggregate
1 Answer 19 Views
This is a migrated thread and some comments may be shown as answers.
Allan
Top achievements
Rank 2
Allan asked on 14 Sep 2013, 03:32 PM
I am attempting to display aggregates in the group header.

I am attempting to use the example from this link:
http://www.telerik.com/help/aspnet-ajax/grid-group-header-footer-templates.html

However I keep getting the following error:

Compiler Error Message: BC30108: 'GridGroupHeaderItem' is a type and cannot be used as an expression.

Source Error:

Line 130: <asp:Label ID="Label7" runat="server" Text='<%# Eval("IDIssueCategory") %>'>

Line 131: </asp:Label>

Line 132: <asp:Label runat="server" ID="Label2" Width="200px" Text='<%# "Number of units: "+ (((GridGroupHeaderItem)Container).AggregatesValues["Subject"]) %>'

Line 133: Visible='<%# ((((GridGroupHeaderItem)Container).AggregatesValues["Subject"]) != null)%>'>

Line 134: </asp:Label>


Here is my code.
<telerik:RadGrid ID="rgd_OpenTickets" runat="server" Skin="WebBlue" CellSpacing="0"
                                    DataSourceID="sds_OpenTickets" GridLines="None" ShowFooter="True" FooterStyle-HorizontalAlign="Left">
                                    <MasterTableView AutoGenerateColumns="False" ClientDataKeyNames="IDIssueCategory"
                                        DataKeyNames="IDIssueCategory" DataSourceID="sds_OpenTickets" HeaderStyle-HorizontalAlign="Center"
                                        ShowFooter="True" ShowGroupFooter="True">
                                        <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                                        <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                                        </RowIndicatorColumn>
                                        <GroupByExpressions>
                                            <telerik:GridGroupByExpression>
                                                <SelectFields>
                                                    <telerik:GridGroupByField FieldName="CategoryName" HeaderText=" " />
                                                </SelectFields>
                                                <GroupByFields>
                                                    <telerik:GridGroupByField FieldName="IDIssueCategory" />
                                                </GroupByFields>
                                            </telerik:GridGroupByExpression>
                                        </GroupByExpressions>
                                        <Columns>
                                            <telerik:GridBoundColumn DataField="IDIssueCategory" DataType="System.Int32" FilterControlAltText="Filter IDIssueCategory column"
                                                HeaderText="IDIssueCategory" SortExpression="IDIssueCategory" UniqueName="IDIssueCategory"
                                                Visible="False">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="CategoryName" DataType="System.Int32" FilterControlAltText="Filter CategoryName column"
                                                HeaderText="CategoryName" SortExpression="CategoryName" UniqueName="CategoryName"
                                                Visible="False">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="IDTicket" DataType="System.Int32" FilterControlAltText="Filter IDTicket column"
                                                HeaderText="ID" ReadOnly="True" SortExpression="IDTicket" UniqueName="IDTicket"
                                                ItemStyle-Width="20px" ItemStyle-HorizontalAlign="Center">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="RequestorUserName" FilterControlAltText="Filter RequestorUserName column"
                                                HeaderText="Requestor" SortExpression="RequestorUserName" UniqueName="RequestorUserName"
                                                ItemStyle-Width="100px" ItemStyle-HorizontalAlign="Left">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="EnteredDate" HeaderText="Enter Date" ItemStyle-Width="65px"
                                                SortExpression="EnteredDate" UniqueName="EnteredDate" FilterControlAltText="Filter EnteredDate column"
                                                HeaderStyle-HorizontalAlign="Center" DataType="System.DateTime" DataFormatString="{0:MM/dd/yy}"
                                                ItemStyle-HorizontalAlign="Center">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="Priority" FilterControlAltText="Filter Priority column"
                                                HeaderText="Priority" SortExpression="Priority" UniqueName="Priority" ItemStyle-Width="20px"
                                                ItemStyle-HorizontalAlign="Center" DataType="System.Decimal">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="Status" FilterControlAltText="Filter Status column"
                                                HeaderText="Status" SortExpression="Status" UniqueName="Status" ReadOnly="True"
                                                ItemStyle-Width="70px">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="Subject" FilterControlAltText="Filter Subject column"
                                                HeaderText="Subject" SortExpression="Subject" UniqueName="Subject" ItemStyle-HorizontalAlign="Left"
                                                FooterStyle-HorizontalAlign="Left" FooterText="Tickets " Aggregate="Count">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="AssignedTech" FilterControlAltText="Filter AssignedTech column"
                                                HeaderText="Tech" ReadOnly="True" SortExpression="AssignedTech" UniqueName="AssignedTech"
                                                ItemStyle-Width="100px" ItemStyle-HorizontalAlign="Left" FooterStyle-HorizontalAlign="Right">
                                            </telerik:GridBoundColumn>
                                        </Columns>
                                        <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
                                        <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                        <GroupHeaderTemplate>
                                            <asp:Label ID="Label7" runat="server" Text='<%# Eval("IDIssueCategory") %>'>
                                            </asp:Label>
                                            <asp:Label runat="server" ID="Label1" Width="200px" Text='<%# "Total: "+ (((GridGroupHeaderItem)Container).AggregatesValues["Subject"]) %>'
                                                Visible='<%# ((((GridGroupHeaderItem)Container).AggregatesValues["Subject"]) != null)%>'>
                                            </asp:Label>
                                        </GroupHeaderTemplate>
                                    </MasterTableView>
                                    <FooterStyle BackColor="#CCFF99" Font-Bold="True"></FooterStyle>
                                    <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
                                    <FilterMenu EnableImageSprites="False">
                                    </FilterMenu>
                                </telerik:RadGrid>


Any help much appreciated.

1 Answer, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 19 Sep 2013, 08:21 AM
Hi Allan,

I was not able to reproduce the issue on my side. I prepared a small sample and attached it to this forum post. Please give it a try and let me know how it differs from your real setup.

Regards,
Kostadin
Telerik
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 the blog feed now.
Tags
Grid
Asked by
Allan
Top achievements
Rank 2
Answers by
Kostadin
Telerik team
Share this question
or