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

Footer with aggregates not showing

9 Answers 40 Views
Grid
This is a migrated thread and some comments may be shown as answers.
david
Top achievements
Rank 1
david asked on 07 Feb 2019, 04:23 PM

We have many grids with a Footer with aggregates that work fine but this grid shows the footer but none of the aggregates display, in other words the footer is blank?

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False"
    OnItemCreated="RadGrid1_ItemCreated"
    OnItemDataBound="RadGrid1_ItemDataBound"
    ShowFooter="true"
    Width="1101px" AllowPaging="True" AllowSorting="True" AllowCustomPaging="True" PageSize="20">
    <ClientSettings EnableRowHoverStyle="True">
        <Selecting AllowRowSelect="True" />
    </ClientSettings>
    <MasterTableView DataKeyNames="ID" CommandItemDisplay="Top" CommandItemSettings-ShowPrintButton="true" CommandItemSettings-ShowRefreshButton="true" CommandItemSettings-ShowExportToExcelButton="true">
        <CommandItemSettings ShowAddNewRecordButton="False" ShowExportToCsvButton="true" ShowExportToExcelButton="true" ShowPrintButton="true" />

        <Columns>
            <telerik:GridBoundColumn DataField="ID" FilterControlAltText="Filter ID column" HeaderText="ID" SortExpression="ID" UniqueName="ID" Display="false">
            </telerik:GridBoundColumn>

            <telerik:GridBoundColumn DataField="ClientID" FilterControlAltText="Filter ClientID column" HeaderText="ClientID" SortExpression="ClientID" UniqueName="ClientID" Display="false">
            </telerik:GridBoundColumn>

            <telerik:GridBoundColumn DataField="PractitionerID" FilterControlAltText="Filter PractitionerID column" HeaderText="PractitionerID" SortExpression="PractitionerID" UniqueName="PractitionerID" Display="false">
            </telerik:GridBoundColumn>

            <telerik:GridBoundColumn DataField="Start" UniqueName="apptDT" Display="false">
            </telerik:GridBoundColumn>

            <telerik:GridTemplateColumn HeaderText="Date" DataField="Start" UniqueName="AppointmentEdit" Visible="true" SortExpression="Start">
                <ItemTemplate>
                    <asp:HyperLink ID="lnkStart" Text='<%# String.Format("{0:g}", DataBinder.Eval(Container.DataItem, "Start")) %>' runat="server"></asp:HyperLink>
                </ItemTemplate>
                <ItemStyle Width="250px" HorizontalAlign="Center" Font-Size="9" />
                <HeaderStyle HorizontalAlign="Center" />
            </telerik:GridTemplateColumn>

            <telerik:GridBoundColumn DataField="lname" UniqueName="lname" Display="true" HeaderText="Practitioner">
            </telerik:GridBoundColumn>

            <telerik:GridBoundColumn DataField="DESCRIPTION" UniqueName="DESCRIPTION" HeaderText="Services" Display="true">
                <ItemStyle Width="100px" HorizontalAlign="Left" />
            </telerik:GridBoundColumn>

            <telerik:GridBoundColumn DataField="Units" DataType="System.Int16" UniqueName="Units" HeaderText="Units" Display="true" Aggregate="Sum" FooterAggregateFormatString="{0:c}">
                <ItemStyle Width="100px" HorizontalAlign="Left" />
            </telerik:GridBoundColumn>

            <telerik:GridBoundColumn DataField="Status" FilterControlAltText="Filter Status column" HeaderText="Status" SortExpression="Status" UniqueName="Status" Display="true">
                <ItemStyle Width="100px" HorizontalAlign="Center" />
                <HeaderStyle Width="100px" HorizontalAlign="Center" />
            </telerik:GridBoundColumn>

            <telerik:GridBoundColumn DataField="Tests" HeaderText="Tests" UniqueName="Tests" Display="true">
                <ItemStyle Width="500px" HorizontalAlign="Left" />
            </telerik:GridBoundColumn>

            <telerik:GridBoundColumn DataField="InvoiceIDX" UniqueName="InvoiceIDX" Display="false">
            </telerik:GridBoundColumn>

            <telerik:GridBoundColumn DataField="InvoiceAmount" HeaderText="Invoice Amount" SortExpression="InvoiceAmount" UniqueName="InvoiceAmount" DataFormatString="{0:c}" Aggregate="Sum" FooterText="$">
                <ItemStyle Width="40px" HorizontalAlign="Center" />
            </telerik:GridBoundColumn>

            <telerik:GridBoundColumn DataField="InvoiceAmountPaid" HeaderText="Amount Paid" SortExpression="InvoiceAmountPaid" UniqueName="InvoiceAmountPaid" DataFormatString="{0:c}" Aggregate="Sum" FooterText="$">
                <ItemStyle Width="40px" HorizontalAlign="Center" />
            </telerik:GridBoundColumn>

            <telerik:GridBoundColumn DataField="UnitPrice" DataType="System.Decimal" FilterControlAltText="Filter UnitPrice column" HeaderText="Unit Price" SortExpression="UnitPrice" UniqueName="UnitPrice" DataFormatString="{0:$#,##0.00}">
                <ItemStyle Width="40px" />
            </telerik:GridBoundColumn>

            <telerik:GridBoundColumn DataField="Billable" DataType="System.Decimal" FilterControlAltText="Filter Billable column" HeaderText="Billable" SortExpression="Billable" UniqueName="Billable" DataFormatString="{0:$#,##0.00}" Aggregate="Sum" FooterText="$">
                <ItemStyle Width="40px" />
            </telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

9 Answers, 1 is accepted

Sort by
0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 11 Feb 2019, 11:49 PM
Hi David,

Thank you for providing the code for the grid. I see that you are using the MasterTableView and defining your data columns which is correct. However, to ensure that you have the aggregate footers available you need to set ShowGroupFooter="true" to the MasterTableView tag. This will light up your group footers. 

Please try this and let me know if you have any additional questions.

Regards,

Eric
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.
0
david
Top achievements
Rank 1
answered on 13 Feb 2019, 03:56 PM

No joy, still no footer

    <MasterTableView DataKeyNames="ID" CommandItemDisplay="Top" CommandItemSettings-ShowPrintButton="true" CommandItemSettings-ShowRefreshButton="true" CommandItemSettings-ShowExportToExcelButton="true" ShowGroupFooter="true">

 

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 13 Feb 2019, 11:40 PM
Hi David,

I noticed in your code that you set the AllowCustomPaging="true"In order to enable custom paging, you need to also set the VirtualItemCount in your MasterTableView as outlined on bullet number 2 in the RadGrid Custom Paging documentation

Can you try this and let me know if that works? 

Regards,

Eric
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.
0
david
Top achievements
Rank 1
answered on 14 Feb 2019, 02:38 PM

Still no joy, worse if I add VirtualItemCount the grid does not render

 AllowPaging="True" AllowSorting="True" AllowCustomPaging="True" PageSize="20" VirtualItemCount="20"

 

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 14 Feb 2019, 10:45 PM
Hi David,


I am sorry to hear that this still is not working as expected. Please take a look at my demo code below. I can't exactly tell where your VirtualItemCount tag is located but from comparing it to the original code it appears to be in the RadGrid tag.

Can you confirm that you placed the VirtualItemCount into the MasterTableView tag and not the parent RadGrid tag? I believe this will resolve the issue. Please try this and let me know.

I look forward to your reply.



Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
        </telerik:RadScriptManager>
        <script type="text/javascript">
        //Put your JavaScript code here.
        </script>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        </telerik:RadAjaxManager>
        <div>
        <telerik:RadGrid ID="RadGrid1" runat="server" ShowFooter="true" AllowPaging="True" AllowSorting="True" AllowCustomPaging="true" PageSize="20">
            <MasterTableView ShowGroupFooter="true" VirtualItemCount="20">
                <Columns>
                    <telerik:GridBoundColumn DataField="OrderID" HeaderText="Order ID" />
                    <telerik:GridBoundColumn DataField="OrderDate" HeaderText="Order Date" />
                    <telerik:GridBoundColumn Aggregate="Sum" DataField="Freight" HeaderText="Freight" FooterText="Total Freight: " />
                    <telerik:GridBoundColumn Aggregate="Count" DataField="ShipName" HeaderText="Ship Name" FooterText="Total for Ship Name: " />
                    <telerik:GridBoundColumn Aggregate="Count" DataField="ShipCountry" HeaderText="Total for Ship Country: " />
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
 
        </div>
    </form>
</body>
</html>


Default.aspx.cs

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
using System.Data;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;
using System.Collections.Generic;
using System.Linq;
 
public partial class Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        RadGrid1.DataSource = MyShipping.GenerateShippers();
    }
}
public class MyShipping
{
    public int OrderID { get; set; }
    public DateTime OrderDate { get; set; }
    public double Freight { get; set; }
    public string ShipName { get; set; }
    public string ShipCountry { get; set; }
 
    public static List<MyShipping> GenerateShippers()
    {
        Random rng = new Random();
        DateTime start = new DateTime(1995, 1, 1);
        return Enumerable.Range(1, 45).Select(i => new MyShipping
        {
            OrderID = rng.Next(18546, 19856),
            OrderDate = start.AddDays(rng.Next((DateTime.Today - start).Days)),
            Freight = Math.Round(rng.NextDouble() * (1000 - 10) + 1000, 2),
            ShipName = $"Name Last {i % 2}",
            ShipCountry = i % 2 == 0 ? "United States of America" : "Canada"
        }).ToList();
    }
}



Regards,

Eric
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.
0
david
Top achievements
Rank 1
answered on 15 Feb 2019, 01:55 PM

no joy

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" CssClass="MyGridView"
    OnItemCreated="RadGrid1_ItemCreated"
    OnItemDataBound="RadGrid1_ItemDataBound"
    Width="1001px" AllowPaging="True" AllowSorting="True"
    AllowCustomPaging="True" PageSize="20"
    CommandItemDisplay="Top">
    <GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
    <ClientSettings EnableRowHoverStyle="True">
        <Selecting AllowRowSelect="True" />
    </ClientSettings>
    <MasterTableView DataKeyNames="ID" CommandItemDisplay="Top" CommandItemSettings-ShowPrintButton="true" CommandItemSettings-ShowRefreshButton="true" ShowGroupFooter="true" VirtualItemCount="20">
        <CommandItemSettings ShowAddNewRecordButton="False" />
        <CommandItemTemplate>
        </CommandItemTemplate>
        <RowIndicatorColumn Visible="False">
        </RowIndicatorColumn>
        <ExpandCollapseColumn Created="True">
        </ExpandCollapseColumn>
        <Columns>

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 18 Feb 2019, 07:49 PM
Hi David,

My apologies for any frustration you may be experiencing. After expanding my sample to match your data model and grid, I found that you have 2 event handlers, OnItemDataBound and OnItemCreated, that may be causing an issue with how you are binding your data.

Just in case you haven't seen the documentation, please review the NeedDataSource binding information in bullet number 3 on the Custom Paging documentation. You can also see this implemented in the online demo Custom Paging.

If the above still does not work I will need to review the entirety of your RadGrid related code. Please post a reply with the code behind for the RadGrid so that I may investigate directly. If you are unable or are concerned with making your code public, please let me know and I can convert this forum post to a support ticket which will allow you to share your code privately. 

I look forward to your reply and thank you for choosing Progress Telerik.

Regards,

Eric
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.
0
david
Top achievements
Rank 1
answered on 18 Feb 2019, 08:29 PM

We really dont want to use custom paging. If we remove the tag AllowCustomPaging="true" or set its property to "false" the grid does not render and throws a script error:

SCRIPT5022: Sys.WebForms.PageRequestManagerServerErrorException: Exception has been thrown thrown by the target of an invocation. Telerik.Web.UI.WebResource.axd (14,16484)

here is the code behind for the event handlers:
    protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            HyperLink GradeForm = e.Item.FindControl("lnkStart") as HyperLink;
            GradeForm.Attributes["href"] = "#";
            GradeForm.Attributes["onclick"] = string.Format("return AppointmentEdit('{0}');", e.Item.ItemIndex);
        }
    }

    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem dataItem = e.Item as GridDataItem;
            string idx = dataItem["InvoiceIDX"].Text;

            if (dataItem["Status"].Text == "Kept")
            {
                HyperLink lnkStart = e.Item.FindControl("lnkStart") as HyperLink;
                lnkStart.Attributes["onclick"] = ""; lnkStart.Attributes["CssClass"] = "lockedColor";
            }
        }
    }

 

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 19 Feb 2019, 04:56 PM
Hi David,

I wanted to reply here to let you know that I have received your reply in the support ticket and will continue the investigation there.

Thank you for your patience and understanding while we work to get you up and running.

Regards,

Eric
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
david
Top achievements
Rank 1
Answers by
Eric R | Senior Technical Support Engineer
Telerik team
david
Top achievements
Rank 1
Share this question
or