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

[Solved] Setting up Column Footer row/cells in code

3 Answers 143 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.
Erik
Top achievements
Rank 1
Erik asked on 15 Feb 2011, 12:03 AM

I'm trying to find a resource on dynamcially creating the RadGridView footer row or Column Footers for a Grid dynamically.  My grid is dynamcially created through code and this is the final piece to my puzzle that I'm not sure how to create. 
Simply showing them (as below) is one thing, but how do you go about adding content to the individual cells or row itself through code??

 

 

dynamicGrid.ShowColumnFooters =

true;

Thanks for any help

 

3 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 15 Feb 2011, 03:51 PM
Hello Erik,

Generally, the content of the columns footers is used for displaying the column aggregates. However, the Footer of each column is of type object and you may define the element you want as follows:

this.clubsGrid.Columns[2].Footer = new TextBlock() { Text = "MyFooter" };

 

Greetings,
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Erik
Top achievements
Rank 1
answered on 17 Feb 2011, 12:30 AM
Thanks for the response Maya.....that worked.  Any reason why the  column aggregates would not be working for me? 
I tried the following code after I loaded my RadGridView and nothing happened....actually if I used the column name it would error, so I used the numeric value in it's place...but no results???
Not sure if me dynamically creating this RGV has anything to do with it

dynamicGrid.ItemsSource =

new DataTable(e.Result);

 


CountFunction f = new CountFunction();

 

 

((GridViewDataColumn)this.dynamicGrid.Columns[1]).AggregateFunctions.Add(f);

//Doesn't work with the name of the column

 

 

//((GridViewDataColumn)this.dynamicGrid.Columns["Column 1"]).AggregateFunctions.Add(f);

 

0
Maya
Telerik team
answered on 17 Feb 2011, 09:10 AM
Hi Erik,

Generally, the column name will be either equal to the corresponding property or to the value you set by the UniqueName property. So, in case the UniqueName property of your column is Column1 for example, using Column 1 will not work. 
As far as the aggregates are concerned, they will not be visible if you add them dynamically through a button for example. You may call Rebind() method of the grid right after adding the function to the AggregateFunctins collection. However, if you define the aggregates during the initialization, they are supposed to be visible.
 

All the best,
Maya
the Telerik team
Tags
GridView
Asked by
Erik
Top achievements
Rank 1
Answers by
Maya
Telerik team
Erik
Top achievements
Rank 1
Share this question
or