I am having difficulty getting the group by Footer Text to have say Subtotal for the groups and then an actual total for everything
I have tried implementing suggestions listed in other forums but none of them seem to work. Any help would be greatly appreciated.
Example what I am trying for is
Type: Type 1 - Water Quality
Data $5
Data $6
Data $4
--Footer Type 1 - Water Quality total sites: 3 $15
Type: Type 2 - Research
Data $10
Data $20
Data $20
--Footer Type 2 - Research total Sites sites: 3 $50
Total sites: 6 $65
FRONT END
<
telerik:RadGrid
ID
=
"rgSite"
runat
=
"server"
AllowSorting
=
"True"
Skin
=
"Silk"
OnNeedDataSource
=
"rgSite_NeedDataSource"
EnableLinqExpressions
=
"false"
OnPreRender
=
"rgSite_PreRender"
AutoGenerateColumns
=
"False"
AlternatingItemStyle-BackColor
=
"White"
Width
=
"1298px"
OnUpdateCommand
=
"rgSite_UpdateCommand"
OnInsertCommand
=
"rgSite_InsertCommand"
>
<
MasterTableView
CommandItemDisplay
=
"Top"
ShowFooter
=
"true"
ShowGroupFooter
=
"true"
DataKeyNames
=
"details_site_id"
>
<
EditFormSettings
PopUpSettings-Modal
=
"false"
UserControlName
=
"controls/FundedSites.ascx"
EditFormType
=
"WebUserControl"
/>
<
CommandItemSettings
ShowRefreshButton
=
"false"
ShowAddNewRecordButton
=
"false"
addnewrecordtext
=
"Add a Site"
/>
<
Columns
>
<
telerik:GridEditCommandColumn
ButtonType
=
"ImageButton"
Visible
=
"false"
UniqueName
=
"Edit"
/>
<
telerik:GridBoundColumn
DataField
=
"site_no"
SortExpression
=
"site_no"
AllowSorting
=
"true"
UniqueName
=
"site_no"
visible
=
"false"
/>
<
telerik:GridTemplateColumn
DataField
=
"site_no_nm"
SortExpression
=
"site_no_nm"
UniqueName
=
"site_no_nm"
HeaderText
=
"Site Number"
ItemStyle-BorderStyle
=
"Solid"
ItemStyle-Bordercolor
=
"Silver"
ItemStyle-BorderWidth
=
"0.25"
Aggregate
=
"CountDistinct"
FooterText
=
"Total Funded Sites: "
>
<
ItemTemplate
>
<
asp:HyperLink
ID
=
"HyperLink1"
runat
=
"server"
NavigateUrl='<%# string.Format("site.aspx?org_cd={0}&cust_id={1}&agmt_id={2}&site_no={3}",org_cd,cust_id,agmt_id,ProcessMyDataItem(Eval("site_no"))) %>'
Text='<%# ProcessMyDataItem(Eval("site_no_nm")) %>'/>
<
asp:HiddenField
runat
=
"server"
ID
=
"hfCollectionUnits"
Visible
=
"false"
Value='<%# ProcessMyDataItem(Eval("data_collection")) %>'/>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
DataField
=
"collection_cd"
SortExpression
=
"collection_cd"
UniqueName
=
"collection_cd"
HeaderText
=
"Code"
ItemStyle-BorderStyle
=
"Solid"
ItemStyle-Bordercolor
=
"Silver"
ItemStyle-BorderWidth
=
"0.25"
>
<
ItemTemplate
>
<
a
title='<%# ProcessMyDataItem(Eval("collection_desc")) %>' style="color:Black;text-decoration:none;">
<%# ProcessMyDataItem(Eval("collection_cd"))%>
</
a
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
DataField
=
"collection_units"
SortExpression
=
"collection_units"
AllowSorting
=
"true"
UniqueName
=
"collection_units"
HeaderText
=
"Units"
ItemStyle-BorderStyle
=
"Solid"
ItemStyle-Bordercolor
=
"Silver"
ItemStyle-BorderWidth
=
"0.25"
ColumnEditorID
=
"ceUnit"
/>
<
telerik:GridBoundColumn
DataField
=
"diff_factor"
SortExpression
=
"diff_factor"
AllowSorting
=
"true"
UniqueName
=
"diff_factor"
HeaderText
=
"Diff. Factor"
ItemStyle-BorderStyle
=
"Solid"
ItemStyle-Bordercolor
=
"Silver"
ItemStyle-BorderWidth
=
"0.25"
ColumnEditorID
=
"ceUnit"
/>
<%--<
telerik:GridBoundColumn
DataField
=
"data_collection"
SortExpression
=
"data_collection"
UniqueName
=
"data_collection"
HeaderText
=
"Data Collection"
Visible
=
"false"
ItemStyle-BorderStyle
=
"Solid"
ItemStyle-Bordercolor
=
"Silver"
ItemStyle-BorderWidth
=
"0.25"
/>--%>
<
telerik:GridNumericColumn
DataField
=
"funding_usgs_cwp"
SortExpression
=
"funding_usgs_cwp"
AllowSorting
=
"true"
UniqueName
=
"funding_usgs_cwp"
HeaderText
=
"USGS CWP"
DataFormatString
=
"{0:c0}"
DataType
=
"System.Decimal"
ItemStyle-BorderStyle
=
"Solid"
ItemStyle-Bordercolor
=
"Silver"
ItemStyle-BorderWidth
=
"0.25"
Aggregate
=
"Sum"
FooterAggregateFormatString
=
"{0:c0}"
ColumnEditorID
=
"ceFunds"
/>
<
telerik:GridNumericColumn
DataField
=
"funding_customer"
SortExpression
=
"funding_customer"
AllowSorting
=
"true"
UniqueName
=
"funding_customer"
HeaderText
=
"Customer"
DataFormatString
=
"{0:c0}"
DataType
=
"System.Decimal"
ItemStyle-BorderStyle
=
"Solid"
ItemStyle-Bordercolor
=
"Silver"
ItemStyle-BorderWidth
=
"0.25"
Aggregate
=
"Sum"
FooterAggregateFormatString
=
"{0:c0}"
ColumnEditorID
=
"ceFunds"
/>
<
telerik:GridBoundColumn
DataField
=
"funding_total"
SortExpression
=
"funding_total"
AllowSorting
=
"true"
UniqueName
=
"total"
HeaderText
=
"Total"
DataFormatString
=
"{0:c0}"
DataType
=
"System.Decimal"
ItemStyle-BorderStyle
=
"Solid"
ItemStyle-Bordercolor
=
"Silver"
ItemStyle-BorderWidth
=
"0.25"
Aggregate
=
"Sum"
FooterAggregateFormatString
=
"{0:c0}"
ReadOnly
=
"true"
/>
<
telerik:GridBoundColumn
DataField
=
"remarks"
SortExpression
=
"remarks"
AllowSorting
=
"true"
UniqueName
=
"remarks"
HeaderText
=
"Remarks"
ItemStyle-BorderStyle
=
"Solid"
ItemStyle-Bordercolor
=
"Silver"
ItemStyle-BorderWidth
=
"0.25"
/>
<
telerik:GridButtonColumn
ConfirmText
=
"Delete this record?"
ConfirmDialogType
=
"RadWindow"
confirmtitle
=
"Delete"
ButtonType
=
"ImageButton"
CommandName
=
"Delete"
Text
=
"Delete"
uniquename
=
"Delete"
Visible
=
"false"
/>
</
Columns
>
<
GroupByExpressions
>
<
telerik:GridGroupByExpression
>
<
SelectFields
>
<
telerik:GridGroupByField
FieldName
=
"data_collection"
FieldAlias
=
"Task"
/>
</
SelectFields
>
<
GroupByFields
>
<
telerik:GridGroupByField
FieldName
=
"data_collection"
/>
</
GroupByFields
>
</
telerik:GridGroupByExpression
>
</
GroupByExpressions
>
<
ExpandCollapseColumn
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
ExpandCollapseColumn
>
</
MasterTableView
>
</
telerik:RadGrid
>
CODE BEHIND
protected
void
rgSite_NeedDataSource(
object
sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
var fundingdb =
new
fundingdbDataContext();
rgSite.DataSource = fundingdb.SP_Funding_Agreement_Sites_Details(Convert.ToInt32(agmt_id),Convert.ToInt32(cust_id)).ToList();
}
//Removes Repeating values
protected
void
rgSite_PreRender(
object
sender, EventArgs e)
{
//The Row Index is the Row above the bottom row, walk up the Grid
for
(
int
rowIndex = rgSite.Items.Count - 2; rowIndex >= 0; rowIndex += -1)
{
//The Current Row is the row index
GridDataItem row = rgSite.Items[rowIndex];
//The Previous Row is one below it
GridDataItem previousRow = rgSite.Items[rowIndex + 1];
//Grab the ItemTemplate Text values from the Hyperlink of the current and previous row and compare them.
if
((row[
"site_no"
].FindControl(
"HyperLink1"
)
as
HyperLink).Text == (previousRow[
"site_no"
].FindControl(
"HyperLink1"
)
as
HyperLink).Text && (row[
"site_no"
].FindControl(
"hfCollectionUnits"
)
as
HiddenField).Value == (previousRow[
"site_no"
].FindControl(
"hfCollectionUnits"
)
as
HiddenField).Value)
{
//If they are the same set the previous rows Text to blank
previousRow[
"site_no_nm"
].Text =
""
;
}
}
}