Hi,
I have tried to sum all rows in a RadGrid column which after some research on www.telerik.com saws as quite simple, but it was not. I am missing something. What I did was that I added DataType="System.Decimal" Aggregate="Sum" in the column binding section.
But this was not enough. The only thing that was visualized in footer was the text 'Sum:'
What am I missing? Do I need to have something in my code behind file?
I have tried to sum all rows in a RadGrid column which after some research on www.telerik.com saws as quite simple, but it was not. I am missing something. What I did was that I added DataType="System.Decimal" Aggregate="Sum" in the column binding section.
<
telerik:GridBoundColumn
DataField
=
"GROSS_FREIGHT_COST"
HeaderText
=
"Bruttofrakt [K]"
UniqueName
=
"GROSS_FREIGHT_COST"
DataType
=
"System.Decimal"
Aggregate
=
"Sum"
>
</
telerik:GridBoundColumn
>
But this was not enough. The only thing that was visualized in footer was the text 'Sum:'
What am I missing? Do I need to have something in my code behind file?
4 Answers, 1 is accepted
0

Jesper
Top achievements
Rank 1
answered on 23 Dec 2010, 11:24 AM
Here's my html code
<%@ Page LCID="1053" Language="C#" AutoEventWireup="true" MasterPageFile="~/Top.Master" CodeBehind="Report_C_R_Items.aspx.cs" Inherits="TRANSPORTal_DEV.Sec.Report_C_R_Items" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<
asp:Content
ID
=
"Content1"
runat
=
"server"
contentplaceholderid
=
"ContentPlaceHolder1"
>
<%-- <
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
>
</
asp:ScriptManager
>--%>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
</
telerik:RadScriptManager
>
<
div
style
=
"width: 1000px"
>
<
center
>
<
table
style
=
"width: 980px"
>
<
tr
style
=
"text-align: right;"
>
<
td
>
<
asp:Label
ID
=
"lblMessage"
runat
=
"server"
></
asp:Label
>
| <
asp:LinkButton
ID
=
"LinkButton1"
runat
=
"server"
onclick
=
"lbtnLogout_Click"
>Logga ut</
asp:LinkButton
></
td
>
</
tr
>
</
table
>
</
center
>
<
center
>
<
div
style
=
"width: 980px; BORDER-RIGHT: 2px groove; BORDER-TOP: 2px groove; BORDER-LEFT: 2px groove; BORDER-BOTTOM: 2px groove;"
>
<
asp:UpdatePanel
ID
=
"UpdatePanel1"
runat
=
"server"
UpdateMode
=
"Conditional"
>
<
ContentTemplate
>
<
table
style
=
"width: 100%; text-align: left"
>
<
tr
>
<
td
style
=
"width: 10px;"
rowspan
=
"3"
></
td
>
<
td
style
=
"width: 200px"
>
Fakturadatum (Från)
<
br
/>
<
asp:TextBox
ID
=
"dtmDateFrom"
runat
=
"server"
Width
=
"130px"
AutoPostBack
=
"True"
ontextchanged
=
"dtmDateFrom_TextChanged"
></
asp:TextBox
>
<
cc1:CalendarExtender
ID
=
"dtmDateFrom_CalendarExtender"
runat
=
"server"
TargetControlID
=
"dtmDateFrom"
FirstDayOfWeek
=
"Monday"
Format
=
"yyyy-MM-dd"
>
</
cc1:CalendarExtender
>
</
td
>
<
td
style
=
"width: 200px"
>
Fakturadatum (Till)<
br
/>
<
asp:TextBox
ID
=
"dtmDateTo"
runat
=
"server"
Width
=
"130px"
AutoPostBack
=
"True"
ontextchanged
=
"dtmDateTo_TextChanged"
></
asp:TextBox
>
<
cc1:CalendarExtender
ID
=
"dtmDateTo_CalendarExtender"
runat
=
"server"
FirstDayOfWeek
=
"Monday"
Format
=
"yyyy-MM-dd"
TargetControlID
=
"dtmDateTo"
>
</
cc1:CalendarExtender
>
</
td
>
<
td
style
=
"width: 200px"
>
</
td
>
<
td
style
=
"width: 200px"
>
</
td
>
<
td
style
=
"width: 170px"
>
</
td
>
</
tr
>
<
tr
>
<
td
>
Transportör<
br
/>
<
asp:DropDownList
ID
=
"ddlTransporter"
runat
=
"server"
Width
=
"140px"
Enabled
=
"False"
>
</
asp:DropDownList
>
</
td
>
<
td
>
Kund<
br
/>
<
asp:DropDownList
ID
=
"ddlCustomer"
runat
=
"server"
AutoPostBack
=
"True"
onselectedindexchanged
=
"ddlCustomer_SelectedIndexChanged"
Width
=
"140px"
AppendDataBoundItems
=
"True"
>
<
asp:ListItem
>--- Välj kund ---</
asp:ListItem
>
</
asp:DropDownList
>
</
td
>
<
td
rowspan
=
"2"
>
Kundnummer<
br
/>
<
asp:ListBox
ID
=
"lstCustomerNo"
runat
=
"server"
Width
=
"150px"
AutoPostBack
=
"True"
onselectedindexchanged
=
"lstCustomerNo_SelectedIndexChanged"
></
asp:ListBox
>
</
td
>
<
td
rowspan
=
"2"
>
Fakturanummer<
br
/>
<
asp:ListBox
ID
=
"lstInvoiceNo"
runat
=
"server"
Width
=
"150px"
AutoPostBack
=
"True"
onselectedindexchanged
=
"lstInvoiceNo_SelectedIndexChanged"
></
asp:ListBox
>
</
td
>
<
td
>
<
br
/>
<
asp:Button
ID
=
"btnShowReport"
runat
=
"server"
Text
=
"Visa rapport"
Width
=
"140px"
onclick
=
"btnShowReport_Click"
Enabled
=
"False"
/>
</
td
>
</
tr
>
<
tr
>
<
td
>
Produkt<
br
/>
<
asp:DropDownList
ID
=
"DropDownList3"
runat
=
"server"
Width
=
"140px"
Enabled
=
"False"
>
</
asp:DropDownList
>
</
td
>
<
td
>
</
td
>
<
td
>
<
br
/>
<
asp:Button
ID
=
"btnExportToExcel"
runat
=
"server"
Text
=
"Exportera till Excel"
Width
=
"140px"
onclick
=
"btnExportToExcel_Click"
/>
</
td
>
</
tr
>
</
table
>
</
ContentTemplate
>
</
asp:UpdatePanel
>
</
div
>
</
center
>
<
br
/>
<
center
>
<
div
style
=
"width: 980px"
>
<
asp:UpdatePanel
ID
=
"UpdatePanel2"
runat
=
"server"
UpdateMode
=
"Conditional"
>
<
ContentTemplate
>
<
asp:Label
ID
=
"lblHtmlContent"
runat
=
"server"
Text
=
""
></
asp:Label
>
</
ContentTemplate
>
<
Triggers
>
<
asp:AsyncPostBackTrigger
ControlID
=
"lstInvoiceNo"
EventName
=
"SelectedIndexChanged"
/>
<
asp:AsyncPostBackTrigger
ControlID
=
"ddlCustomer"
EventName
=
"SelectedIndexChanged"
/>
<
asp:AsyncPostBackTrigger
ControlID
=
"lstCustomerNo"
EventName
=
"SelectedIndexChanged"
/>
<
asp:AsyncPostBackTrigger
ControlID
=
"dtmDateFrom"
EventName
=
"TextChanged"
/>
<
asp:AsyncPostBackTrigger
ControlID
=
"dtmDateTo"
EventName
=
"TextChanged"
/>
<
asp:PostBackTrigger
ControlID
=
"btnExportToExcel"
/>
</
Triggers
>
</
asp:UpdatePanel
>
</
div
>
<
div
style
=
"width: 980px; height: 371px"
>
<
asp:UpdatePanel
ID
=
"UpdatePanel3"
runat
=
"server"
UpdateMode
=
"Conditional"
>
<
ContentTemplate
>
<
asp:Label
ID
=
"lblInfoMessage"
runat
=
"server"
Font-Bold
=
"True"
ForeColor
=
"Red"
></
asp:Label
>
<
telerik:RadGrid
ID
=
"gvParcelInvoiceCIItems"
runat
=
"server"
AutoGenerateColumns
=
"False"
GridLines
=
"None"
>
<
MasterTableView
ShowFooter
=
"True"
>
<
RowIndicatorColumn
>
<
HeaderStyle
Width
=
"20px"
/>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
>
<
HeaderStyle
Width
=
"20px"
/>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"PRODUCT"
HeaderText
=
"Produkt"
UniqueName
=
"PRODUCT"
Aggregate
=
"Count"
FooterText
=
"Antal sändningar: "
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"EXEC_DTM"
DataFormatString
=
"{0:yyyy-MM-dd}"
HeaderText
=
"Transportdag"
UniqueName
=
"EXEC_DTM"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"SHIPMENT_ID"
HeaderText
=
"Sändningsnr"
UniqueName
=
"SHIPMENT_ID"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"OW_TO_COUNTRY"
HeaderText
=
"Mot.land"
UniqueName
=
"OW_TO_COUNTRY"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"WEIGHT"
HeaderText
=
"Vikt (kg)"
UniqueName
=
"WEIGHT"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"NO_OF_PACKAGES"
HeaderText
=
"Kolli"
UniqueName
=
"NO_OF_PACKAGES"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"GROSS_FREIGHT_COST"
HeaderText
=
"Bruttofrakt [K]"
UniqueName
=
"GROSS_FREIGHT_COST"
DataType
=
"System.Decimal"
Aggregate
=
"Sum"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"SURCHARGES_TOTAL_COST"
HeaderText
=
"Tillägg/Tillval [K]"
UniqueName
=
"SURCHARGES_TOTAL_COST"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"SURCHARGE_DMT_COST"
HeaderText
=
"DMT [K]"
UniqueName
=
"SURCHARGE_DMT_COST"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"TOTAL_FREIGHT_COST"
HeaderText
=
"Totalt frakt [K]"
UniqueName
=
"TOTAL_FREIGHT_COST"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"GROSS_FREIGHT_REVENUE"
HeaderText
=
"Bruttofrakt [I]"
UniqueName
=
"GROSS_FREIGHT_REVENUE"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"SURCHARGES_TOTAL_REVENUE"
HeaderText
=
"Tillägg/Tillval [I]"
UniqueName
=
"SURCHARGES_TOTAL_REVENUE"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"SURCHARGE_DMT_REVENUE"
HeaderText
=
"DMT [I]"
UniqueName
=
"SURCHARGE_DMT_REVENUE"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"TOTAL_FREIGHT_REVENUE"
HeaderText
=
"Totalt frakt [I]"
UniqueName
=
"TOTAL_FREIGHT_REVENUE"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Margin (%)"
HeaderText
=
"Marginal (%)"
UniqueName
=
"Margin (%)"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"SURCHARGE_DMT_PCT"
HeaderText
=
"DMT (%)"
UniqueName
=
"SURCHARGE_DMT_PCT"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
>
<
Scrolling
AllowScroll
=
"True"
UseStaticHeaders
=
"True"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
<
br
/>
<
asp:Label
ID
=
"lblDatabaseInfo"
runat
=
"server"
></
asp:Label
>
</
ContentTemplate
>
<
Triggers
>
<
asp:AsyncPostBackTrigger
ControlID
=
"btnShowReport"
EventName
=
"Click"
/>
<
asp:AsyncPostBackTrigger
ControlID
=
"ddlCustomer"
EventName
=
"SelectedIndexChanged"
/>
<
asp:AsyncPostBackTrigger
ControlID
=
"lstCustomerNo"
EventName
=
"SelectedIndexChanged"
/>
<
asp:AsyncPostBackTrigger
ControlID
=
"lstInvoiceNo"
EventName
=
"SelectedIndexChanged"
/>
<
asp:AsyncPostBackTrigger
ControlID
=
"dtmDateFrom"
EventName
=
"TextChanged"
/>
<
asp:AsyncPostBackTrigger
ControlID
=
"dtmDateTo"
EventName
=
"TextChanged"
/>
</
Triggers
>
</
asp:UpdatePanel
>
</
div
>
</
center
>
</
div
>
</
asp:Content
>
0
Hi Jesper,
I recommend that you examine the following links which elaborate on this subject and see what is the difference in your case:
Totals in grid footers
Footer Aggregates
Kind regards,
Pavlina
the Telerik team
I recommend that you examine the following links which elaborate on this subject and see what is the difference in your case:
Totals in grid footers
Footer Aggregates
Kind regards,
Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

Jesper
Top achievements
Rank 1
answered on 23 Dec 2010, 11:40 AM
Hi Pavlina,
I'm a little bit confused. Do I need to have some code in my code behind? From my understanding I don't need this for simple summation of all rows for a column, right?
Could the reason for not working for me be my Ajax? And especially for my button 'btnShowReport' that triggers the loading of RadGrid?
I'm a little bit confused. Do I need to have some code in my code behind? From my understanding I don't need this for simple summation of all rows for a column, right?
Could the reason for not working for me be my Ajax? And especially for my button 'btnShowReport' that triggers the loading of RadGrid?
<
Triggers
>
<
asp:AsyncPostBackTrigger
ControlID
=
"btnShowReport"
EventName
=
"Click"
/>
<
asp:AsyncPostBackTrigger
ControlID
=
"ddlCustomer"
EventName
=
"SelectedIndexChanged"
/>
<
asp:AsyncPostBackTrigger
ControlID
=
"lstCustomerNo"
EventName
=
"SelectedIndexChanged"
/>
<
asp:AsyncPostBackTrigger
ControlID
=
"lstInvoiceNo"
EventName
=
"SelectedIndexChanged"
/>
<
asp:AsyncPostBackTrigger
ControlID
=
"dtmDateFrom"
EventName
=
"TextChanged"
/>
<
asp:AsyncPostBackTrigger
ControlID
=
"dtmDateTo"
EventName
=
"TextChanged"
/>
</
Triggers
>
0
Hi Jesper,
Could you please send us a runnable sample illustrating your scenario and the issues you are facing? You can try opening a formal support ticket where you can attach the project files.
I could then debug it locally and find a proper resolution for you. Otherwise it would hard to determine the source of the problem based on the provided information.
Looking forward your reply.
Regards,
Pavlina
the Telerik team
Could you please send us a runnable sample illustrating your scenario and the issues you are facing? You can try opening a formal support ticket where you can attach the project files.
I could then debug it locally and find a proper resolution for you. Otherwise it would hard to determine the source of the problem based on the provided information.
Looking forward your reply.
Regards,
Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.