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

Group-Footer Text and Grid-Footer Text not showing

5 Answers 448 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lokesh
Top achievements
Rank 1
Lokesh asked on 19 Jul 2012, 09:51 AM
Hi Team,
I have a hierarchical grid in which I wan to show sum of values in columns for Groups as well as for total column also.
It was working fine before, but don't know what happened, it is not showing the Footer Text now..

This is my Grid :

<telerik:RadGrid ID="rgProjectBudget" OnNeedDataSource="rgProjectBudget_NeedDataSource"  runat="server" GridLines="None" ShowGroupPanel="false" AllowMultiRowSelection="true" OnDeleteCommand="rgProjectBudget_DeleteCommand" AutoGenerateColumns="False" AllowSorting="True" AllowPaging="false" ShowFooter="true">
                                                <MasterTableView Width="100%" GroupsDefaultExpanded="false" ExpandCollapseColumn-Groupable="true"  CommandItemSettings-ShowAddNewRecordButton="false" GroupLoadMode="Client" ShowGroupFooter="true">
                                                    <GroupByExpressions>
                                                        <telerik:GridGroupByExpression>
                                                            <SelectFields>
                                                                <telerik:GridGroupByField FieldAlias="ChartOfAccountSetDetailDescription" FieldName="ChartOfAccountSetDetailDescription" HeaderText="GL Account" HeaderValueSeparator=" : "></telerik:GridGroupByField>
                                                            </SelectFields>
                                                            <GroupByFields>
                                                                <telerik:GridGroupByField FieldName="ChartOfAccountSetDetailDescription" SortOrder="Descending"></telerik:GridGroupByField>
                                                            </GroupByFields>
                                                        </telerik:GridGroupByExpression>
                                                    </GroupByExpressions>
                                                    <Columns>
                                                        <telerik:GridBoundColumn DataField="ChartOfAccountSetDetailValueCode" DataType="System.String" HeaderText="Project Heads" AllowFiltering="true" AutoPostBackOnFilter="true" FilterControlWidth="30%" CurrentFilterFunction="Contains" UniqueName="ChartOfAccountSetDetailValueCode">
                                                            <HeaderStyle HorizontalAlign="Left" /><ItemStyle HorizontalAlign="Left" Width="10%" />
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="ChartOfAccountSetDetailDescription" DataType="System.String" HeaderText="Description" AllowFiltering="true" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" UniqueName="ChartOfAccountSetDetailDescription" FilterControlWidth="60%">
                                                            <HeaderStyle HorizontalAlign="Left" /><ItemStyle HorizontalAlign="Left" Width="10%" />
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="PurchaseOrderNo" DataType="System.String" HeaderText="PO No" AllowFiltering="true" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" UniqueName="PurchaseOrderNo" FilterControlWidth="60%">
                                                            <HeaderStyle HorizontalAlign="Left" /><ItemStyle HorizontalAlign="Left" Width="10%" />
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="GR_Number" DataType="System.String" HeaderText="GR No" AllowFiltering="true" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" UniqueName="GR_Number" FilterControlWidth="60%">
                                                            <HeaderStyle HorizontalAlign="Left" /><ItemStyle HorizontalAlign="Left" Width="10%" />
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn UniqueName="QuotedValue" HeaderText="Quoted Amount" DataField="QuotedValue" CurrentFilterFunction="EqualTo" AllowFiltering="true" DataType="System.Double" DataFormatString="{0:N}" FilterControlWidth="30%" AutoPostBackOnFilter="true" Aggregate="Sum" FooterText="Quoted Value: ">
                                                            <HeaderStyle HorizontalAlign="Left" /><ItemStyle HorizontalAlign="Right" Width="10%" /><FooterStyle HorizontalAlign="Right" />
                                                            <FooterStyle HorizontalAlign="Right" />
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn UniqueName="SecondaryEntityBudget" HeaderText="PV1" DataField="SecondaryEntityBudget" DataFormatString="{0:N}" CurrentFilterFunction="EqualTo" AllowFiltering="true" DataType="System.Double" Aggregate="Sum" FooterText="PV1: " FilterControlWidth="30%" AutoPostBackOnFilter="true">
                                                            <HeaderStyle HorizontalAlign="Left" /><ItemStyle HorizontalAlign="Right" Width="10%" /><FooterStyle HorizontalAlign="Right" />
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn UniqueName="SupplementaryBudget1" HeaderText="PV0" DataField="SupplementaryBudget1" DataFormatString="{0:N}" CurrentFilterFunction="EqualTo" AllowFiltering="true" DataType="System.Double" Aggregate="Sum" FooterText="PV0: " FilterControlWidth="30%" AutoPostBackOnFilter="true">
                                                            <HeaderStyle HorizontalAlign="Left" /><ItemStyle HorizontalAlign="Right" Width="10%" /><FooterStyle HorizontalAlign="Right" />
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn UniqueName="COARequisitionAmount" HeaderText="Commited" DataField="COARequisitionAmount" FooterText="Commited: " CurrentFilterFunction="Contains" AllowFiltering="true" DataFormatString="{0:N}" AutoPostBackOnFilter="true" Aggregate="Sum">
                                                            <HeaderStyle HorizontalAlign="Left" /><ItemStyle HorizontalAlign="Right" Width="10%" /><FooterStyle HorizontalAlign="Right" />
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn UniqueName="COAActualAmount" HeaderText="Actual Amount" Aggregate="Sum" FooterText="Actual Amount: " DataField="COAActualAmount" CurrentFilterFunction="EqualTo" AllowFiltering="true" DataFormatString="{0:N}" DataType="System.Double" FilterControlWidth="30%" AutoPostBackOnFilter="true">
                                                            <HeaderStyle HorizontalAlign="Left" /><ItemStyle HorizontalAlign="Right" Width="10%" /><FooterStyle HorizontalAlign="Right" />
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridCalculatedColumn HeaderText="Balance" UniqueName="Balance" DataType="System.Double" DataFormatString="{0:N}" DataFields="SecondaryEntityBudget,COARequisitionAmount,COAActualAmount" Expression="{0}-({1}+{2})" FooterText="Balance: " Aggregate="Sum">
                                                            <HeaderStyle HorizontalAlign="Left" /><ItemStyle HorizontalAlign="Right" Width="10%" /><FooterStyle HorizontalAlign="Right" />
                                                        </telerik:GridCalculatedColumn>
                                                        <telerik:GridBoundColumn DataField="StatusID" DataType="System.Int32" HeaderText="StatusID" UniqueName="StatusID" Display="false"></telerik:GridBoundColumn>
                                                        <telerik:GridHyperLinkColumn DataTextField="StatusName" DataType="System.String" ItemStyle-HorizontalAlign="Center" HeaderText="Status" UniqueName="StatusName" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" DataNavigateUrlFields="COABudgetDetailID,SecondaryEntityBudget,SupplementaryBudget1,SupplementaryBudget2" DataNavigateUrlFormatString="javascript:CheckBudgetAmount({0},{1},{2},{3});" Visible="false"></telerik:GridHyperLinkColumn>
                                                        <telerik:GridBoundColumn DataField="SecondaryEntityBudgetApproved" DataType="System.Double" Display="false" HeaderText="SecondaryEntityBudgetApproved" UniqueName="SecondaryEntityBudgetApproved">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="SupplementaryBudget1Approved" DataType="System.Double" Display="false" HeaderText="SupplementaryBudget1Approved" UniqueName="SupplementaryBudget1Approved">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="SupplementaryBudget2Approved" DataType="System.Double" Display="false" HeaderText="SupplementaryBudget2Approved" UniqueName="SupplementaryBudget2Approved">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridTemplateColumn HeaderText="Not Applicable" UniqueName="IsBudgetNotApplicable" FilterControlWidth="20%" CurrentFilterFunction="Contains" AllowFiltering="true" AutoPostBackOnFilter="true" Display="false">
                                                            <ItemTemplate>
                                                                <asp:CheckBox ID="chkApplicable" runat="server" Checked='<%# DataBinder.Eval(Container,"DataItem.IsBudgetNotApplicable") %>' Visible="false" />
                                                            </ItemTemplate>
                                                            <HeaderStyle HorizontalAlign="Left" /><ItemStyle HorizontalAlign="Left" Width="10%" />
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridCheckBoxColumn DataField="IsParent" UniqueName="IsParent" HeaderText="IsParent" Display="false"></telerik:GridCheckBoxColumn>
                                                        <telerik:GridBoundColumn DataField="IsParent" UniqueName="IsParent1" HeaderText="IsParent1" Display="false"></telerik:GridBoundColumn>
                                                        <telerik:GridClientSelectColumn HeaderText="Select" UniqueName="Select" Display="false"></telerik:GridClientSelectColumn>
                                                        <telerik:GridButtonColumn CommandName="Delete" HeaderText="Delete?" Text="Delete" Display="false" UniqueName="DeleteCommandColumn" ButtonType="ImageButton" ConfirmText="Are you sure you want to delete ?">
                                                        </telerik:GridButtonColumn>
                                                    </Columns>
                                                </MasterTableView>
                                                <ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="false" AllowColumnsReorder="True">
                                                    <Selecting AllowRowSelect="True"></Selecting>
                                                    <Resizing AllowRowResize="True" AllowColumnResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="False"></Resizing>
                                                </ClientSettings>
                                                <GroupingSettings ShowUnGroupButton="true" RetainGroupFootersVisibility="true" />
                                            </telerik:RadGrid>

Any help appreciated.
Thanks,
Lok..

5 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 23 Jul 2012, 10:28 AM
Hi Lokesh,

Please note that you should use YourTableView_DataBinding event in order to preserve the applied formatting to data values in the column aggregate and still be able to add the name of the currently selected aggregate function as demonstrated in the following demo:
 Grid / Footer Aggregates

In your case you will probably want to use:
protected void MasterTableView_DataBinding(object sender, EventArgs e)
{
    GridBoundColumn quotedValueCol = rgProjectBudget.MasterTableView.GetColumnSafe("QuotedValue") as GridBoundColumn;
    quotedValueCol.FooterAggregateFormatString = "Quoted Value: " + "{0:N}";
}

I hope this will prove helpful.

Kind regards,
Eyup
the Telerik team
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 their blog feed now.
0
Lokesh
Top achievements
Rank 1
answered on 23 Jul 2012, 10:40 AM
Hi Eyup  ,
As I said, it was working fine. But all of a sudden it is not showing the total. It sounds crazy but it is true. I don't have any other events to maintain applied formatting. And I don't think it is needed just to maintain the formatting.
I am totally clueless about it.
Please help.

Thanks,
Lok..
0
Lokesh
Top achievements
Rank 1
answered on 24 Jul 2012, 10:43 AM
Hi Eyup,
FYI, I referred this online demo to show sum in group footer in which  MasterTableView_DataBinding  event is not implemented .
Can you please shed some more light on the issue now ?

Thanks,
Lok..
0
Accepted
Eyup
Telerik team
answered on 24 Jul 2012, 11:13 AM
Hi Lokesh,

Please note that this issue is related to the formatting applied to your column's contents. In the demo you have mentioned there is no formatting done to  the values. However, in your own project you are using DataFormatString="{0:N}". Therefore, you will need to implement the suggested approach in my previous reply or use the FooterAggregateFormatString property as demonstrated below:
 
< ... DataFormatString="{0:N}" Aggregate="Sum" FooterAggregateFormatString="Quoted Value: {0}">

That should do the trick.

Kind regards,
Eyup
the Telerik team
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 their blog feed now.
0
Lokesh
Top achievements
Rank 1
answered on 24 Jul 2012, 12:55 PM
Hi Eyup,
Thanks a lot.
That was it. I didn't know the property "FooterAggregateFormatString".  
At first, I had not applied the formatting and the problem came after applying the formatting.
It is working now.
Thanks again.
Lok..
Tags
Grid
Asked by
Lokesh
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Lokesh
Top achievements
Rank 1
Share this question
or