Group Header Aggregate

2 posts, 0 answers
  1. Allan
    Allan avatar
    121 posts
    Member since:
    Jun 2008

    Posted 14 Sep 2013 Link to this post

    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.

  2. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 19 Sep 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top