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

Total dynamically generated columns and rows

1 Answer 101 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Web Services
Top achievements
Rank 2
Web Services asked on 20 Jan 2014, 10:41 PM
I have a grid that is dynamically generated. It's a time clock grid, so I am dynamically adding columns as well as rows. It's based on user input, so I cannot rely on a specified number of columns or column names. So, here is my question, I need to total both columns and rows. What is the best way to accomplish this? Should I just loop through my grid after I've bound it and manually add another column? I've attached an image of what I need to do.

How I'm binding this is by looping through some stuff, dynamically creating the columns, then looping through again and dynamically adding rows. I have that working just fine, but I can post my code if you need it.

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 23 Jan 2014, 10:08 PM
Hi,

How to dynamically calculates totals in grid you can learn from Programmatic solution section in the following help article:
Totals in grid footer

Regarding row totals you can try using GridCalculatedColumn. This column displays a value that is calculated based on one or more fields and an expression that indicates how to calculate the display value. Use the DataFields property to list all the fields that are used to calculate the column value. You can checkout the following link for demo which demonstrates the usage of GridCalculatedColumn in RadGrid:
Grid / Calculated Columns

Regards,
Pavlina
Telerik
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 the blog feed now.
Tags
Grid
Asked by
Web Services
Top achievements
Rank 2
Answers by
Pavlina
Telerik team
Share this question
or