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

Aggregate functions

10 Answers 104 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Hari
Top achievements
Rank 1
Hari asked on 30 Nov 2011, 01:33 PM
Hi,
I have a custom grid inherited from telerik radgrid. I need to display the count of rows at the bottom of the grid. I need to do this is the customgrid.cs file programatically. Any pointers on this?

10 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 30 Nov 2011, 01:59 PM
Hi Hari,

 

Will you clarify what do you mean by "I need to display the count of rows at the bottom of the grid"
Do you want to embed this in the default template of your custom grid with a single element which will display the item count or maybe I am missing something? Generally you may get the number of items as shown below:

this.customGridView.Items.Count.ToString();

You may also define aggregates - in our online documentation you will find a detailed information on this topic, following this link. 


Greetings,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Hari
Top achievements
Rank 1
answered on 01 Dec 2011, 06:15 AM
Hi,
Yes, i want to embed in the default template of my grid with a single element. but how do i create an element in the class file?
0
Pavel Pavlov
Telerik team
answered on 02 Dec 2011, 03:12 PM
Hello Hari,

There is  need to add another visual , to display the count. RadGridView already offers such visual - it is the column footer .

What you need to do is to make the column footers visible and add a Count aggregate function.  Both actions you can see described in the link to the online help provided bellow.

Regards,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Hari
Top achievements
Rank 1
answered on 05 Dec 2011, 07:54 AM
Hi,
I did the same and it worked. But i have a context menu for my grid. It will contain all the column names present in the grid. on checking and uncheking each value, i am making that column visible or invisble. So if i put the row count for the last column and hide it, the row count is getting hidden. Please help.
0
Hari
Top achievements
Rank 1
answered on 05 Dec 2011, 07:54 AM
Hi,
I did the same and it worked. But i have a context menu for my grid. It will contain all the column names present in the grid. on checking and uncheking each value, i am making that column visible or invisble. So if i put the row count for the last column and hide it, the row count is getting hidden. Please help.
0
Hari
Top achievements
Rank 1
answered on 05 Dec 2011, 07:54 AM
Hi,
I did the same and it worked. But i have a context menu for my grid. It will contain all the column names present in the grid. on checking and uncheking each value, i am making that column visible or invisble. So if i put the row count for the last column and hide it, the row count is getting hidden. Please help.
0
Hari
Top achievements
Rank 1
answered on 05 Dec 2011, 07:55 AM
Hi,
I did the same and it worked. But i have a context menu for my grid. It will contain all the column names present in the grid. on checking and uncheking each value, i am making that column visible or invisble. So if i put the row count for the last column and hide it, the row count is getting hidden. Please help.
0
Hari
Top achievements
Rank 1
answered on 05 Dec 2011, 07:55 AM
Hi,
I did the same and it worked. But i have a context menu for my grid. It will contain all the column names present in the grid. on checking and uncheking each value, i am making that column visible or invisble. So if i put the row count for the last column and hide it, the row count is getting hidden. Please help.
0
Hari
Top achievements
Rank 1
answered on 05 Dec 2011, 07:55 AM
Hi,
I did the same and it worked. But i have a context menu for my grid. It will contain all the column names present in the grid. on checking and uncheking each value, i am making that column visible or invisble. So if i put the row count for the last column and hide it, the row count is getting hidden. Please help.
0
Pavel Pavlov
Telerik team
answered on 08 Dec 2011, 10:48 AM
Hi Hari,

I am attaching a small sample. It contains a code snippet that injects a textbox in the visual tree of RadGridView. This textbox is bound to the count of the items.

Of course the same result may be achieved in XAML - e.g. using Expression Blend , you may modify the default template of RadGridView and place the text box without code behind.

Regards,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Hari
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Hari
Top achievements
Rank 1
Pavel Pavlov
Telerik team
Share this question
or