Total dynamically generated columns and rows

2 posts, 0 answers
  1. Web Services
    Web Services avatar
    243 posts
    Member since:
    Apr 2008

    Posted 20 Jan 2014 Link to this post

    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.
  2. Pavlina
    Pavlina avatar
    6187 posts

    Posted 23 Jan 2014 Link to this post


    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

    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.
Back to Top