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

[Solved] Custom footer issue

1 Answer 84 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Krystal
Top achievements
Rank 1
Krystal asked on 19 Jul 2011, 05:49 PM
Hi,
I have a grid view with 20+ columns and custom footers to show the total based on some business logic.

My issue is when I scroll to the right, some of the columns footer values are missing. (see attached screen shot). this happens when first time page is loading. But if I go to other Tabs on the page and come back again, then some of the misssing footer values are showing but not all.
Below is my xaml code:
<telerikgridview:RadGridView Name="grdNoms" ShowGroupPanel="False" AutoGenerateColumns="False" ShowInsertRow="False" RowIndicatorVisibility="Visible" 
                                     ShowColumnFooters="true" Grid.Row="1" HorizontalAlignment="Left" CanUserFreezeColumns="False"  
                                     EnableColumnVirtualization="False" EnableRowVirtualization="True" FrozenColumnCount="1" SelectionMode="Extended" 
                                     RowLoaded="grdNoms_RowLoaded" DataLoaded="grdNoms_DataLoaded">
<telerikgridview:RadGridView.Columns>
                            <telerikgridview:GridViewDataColumn Header="Well Name" UniqueName="unqWellName" IsReadOnly="True" 
                                      TextWrapping="Wrap" IsSortable="True" SortMemberPath="WellName" 
                                      IsFilterable="True" DataMemberBinding="{Binding WellName}" HeaderCellStyle="{StaticResource GridViewHeaderBackgroundStyle}" Footer="Total: " FooterTextAlignment="Center">
                            </telerikgridview:GridViewDataColumn>
  
                            <telerikgridview:GridViewDataColumn Header="Vol1" UniqueName="unqDayN3Vol1" IsReadOnly="True" IsSortable="True" SortMemberPath="DayN3Vol1" IsFilterable="False" DataMemberBinding="{Binding DayN3Vol1}" HeaderCellStyle="{StaticResource GridViewHeaderBackgroundStyle}" CellStyle="{StaticResource GridViewCellStyle_Alternate}" DataFormatString="{}{0:N0}" FooterTextAlignment="Center" >
                                <telerikgridview:GridViewDataColumn.CellTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="{Binding DayN3Vol1, StringFormat='N0'}"></TextBlock>
                                            <TextBlock Text="{Binding DayN3StatusCode}" ></TextBlock>
                                        </StackPanel>
                                    </DataTemplate>
                                </telerikgridview:GridViewDataColumn.CellTemplate>
                                <telerikgridview:GridViewDataColumn.Footer>
                                    <TextBlock Text="" />
                                </telerikgridview:GridViewDataColumn.Footer>
                            </telerikgridview:GridViewDataColumn>
</telerikgridview:RadGridView.Columns>
                    </telerikgridview:RadGridView>

And here is the code which populates footer text.
private void grdNoms_DataLoaded(object sender, EventArgs e)
        {
            TextBlock oTxt = null;
  
            try
            {
                if (oFooterData != null)
                {
                    foreach (GridViewColumn oCol in grdNoms.Columns)
                    {
                        oTxt = oCol.Footer as TextBlock;
  
                        if (oTxt != null)
                            oTxt.Text = oFooterData[oCol.UniqueName].ToString("N0");
                    }
                }
            }
            catch (Exception _ex)
            {
                LogErrorMessage(_ex, "grdNoms_DataLoaded");
            }
        }

Please can some one help me to overcome this issue. And BTW, I am using Telerik version 2011.1.419.1040

Thanks.


1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 20 Jul 2011, 08:48 AM
Hello Krystal,

I would recommend you to define aggregate functions instead. If the built-in aggregates are no appropriate for you, you may either create a custom one or add a generic AggregateExpression
Let me know in case you need any further assistance.

Kind regards,
Maya
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
GridView
Asked by
Krystal
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or