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

2q2009 RadGridView Footer Row Sample Question

6 Answers 144 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Byron
Top achievements
Rank 1
Byron asked on 02 Jul 2009, 07:31 PM
How do you build a footer row like you have in the 2q 2009 sample in code vs. xaml???

Currently, our databinding, column configuration, and most everything else is being developed in our code behinds instead of xaml.


Thanks,
Byron



6 Answers, 1 is accepted

Sort by
0
Byron
Top achievements
Rank 1
answered on 02 Jul 2009, 10:14 PM
OK,,,I think I may have this figured out, BUT,,,,if I attempt to do it in the codebehind the app throws an exception
 

"Logical tree depth exceeded while traversing the tree. This could indicate a cycle in the tree."

I put together a simple sample app that just displays a table and attempts to sum a column. If I do it in XAML it works great, but I need to be able to do this in the codebehind. 

Here's a snippet of code....ShowColumnFooters is set to true in the XAML,,,doesn't matter if I put it in the xaml or code behind as soon as I attempt to do this inside the codebehind it errors. If I remove the showcolumnfooters and leave everything else as is, it'll display the column in question.....but I can't get the footerrow.

This was just a quick test to try to figure this out.......am I missing something????

 

DataClasses1DataContext dc = new DataClasses1DataContext();

 

gridview1.ItemsSource = dc.FACDAILYPENALTies;

 

GridViewDataColumn column = new GridViewDataColumn();

 

column.Header =

"PenVol2";

 

column.DataType =

typeof(Int32);

 

column.UniqueName =

"PENALTYVOLUME";

 

column.DataMemberPath =

"PENALTYVOLUME";

 

 

SumFunction sum = new SumFunction();

 

sum.Caption =

"Sum: ";

 

sum.ResultFormatString =

"{}{0:c}";

 

sum.SourceField =

"PENALTYVOLUME";

 

 

 

GridViewFooterRow footerRow = new GridViewFooterRow();

 

column.AggregateFunctions.Add(sum);

column.Footer = footerRow;

gridview1.Columns.Add(column);

 

 



0
Byron
Top achievements
Rank 1
answered on 02 Jul 2009, 10:42 PM
I think I'm getting closer,,,,,I seem to have overlooked the gridviewfootercell, but I'm still having trouble putting the pieces together....
0
Byron
Top achievements
Rank 1
answered on 02 Jul 2009, 11:41 PM
How many times can Byron post to this thread in a day......plenty. :-)

I figured it out.......
0
Udi Dahan
Top achievements
Rank 1
answered on 05 Aug 2009, 07:20 AM

Hi Byron,

I am receiving the same “Logical tree depth exceeded while traversing the tree. This could indicate a cycle in the tree.” error.My scenario is different, but since this is the only post that mentions the error, I am wondering what caused and solved the error for you?

Thanks

0
Byron
Top achievements
Rank 1
answered on 05 Aug 2009, 12:38 PM
For my scenario, the xaml contains very little, as noted we do most everything in the code behind. So, my xaml for the grid is basically this:

<gridview:RadGridView Name="radGridView" ShowColumnFooters="True" telerik:StyleManager.Theme="Vista" Grid.Column="1" Grid.ColumnSpan="17" Margin="8,15,60,0" Grid.Row="5" Grid.RowSpan="10"></gridview:RadGridView>

And I set ShowColumnFooters = true,,,,this pretty much took care of my problem, I was able to do everything else in the code behind.

For common operations on our grids we have a utilities class with a number of public static methods. One of them is CreateRadGridViewColumnn() and that method has various overloads. One of the overloaded methods is for handling columns with aggregates.  When the column is created,  we use the overloaded method to to configure that column and that overloaded method based on the parameters passed to it calls another method that gets/configures the aggregate function to be added to the column. Once the aggregate is added to the column, you're pretty much done.....

With the XAML set to show the column footers and the aggregate being added in side my create column method, that solved me problem, it would display the aggregated data in the column footer just as intended.

Byron






 

0
Udi Dahan
Top achievements
Rank 1
answered on 05 Aug 2009, 03:38 PM
Thank you very much :)
Tags
GridView
Asked by
Byron
Top achievements
Rank 1
Answers by
Byron
Top achievements
Rank 1
Udi Dahan
Top achievements
Rank 1
Share this question
or