Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
235
How to SUM a TemplateDataField column
posted

Hello,

I have a template data field column in a WebHierarchicalDataGrid and I need to sum the $ amounts.  The column will show an ASP Button if the decimal value from the database is NULL, else it will show a LinkButton whose text is the decimal amount if it is NOT NULL.

What I've been able to do so far is add a hidden column that is a BoundDataField item, and setup a SUM calculation for it.  The tricky part is moving that sum (which is in the HTML source once the grid is rendered) over to the TemplateDataField column summary cell.

I do have some code that is achieving this:

<ClientEvents Initialize="whdgLateCharges_ContainerGrid_Initialize" />

<script type="text/javascript" id="igClientScript">
function whdgLateCharges_ContainerGrid_Initialize(sender, eventArgs) {
var summaryRow = sender.get_behaviors().get_summaryRow();
var elements = summaryRow.get_element().getElementsByClassName("igg_Summary");
elements.item(12).innerHTML = elements.item(13).innerHTML;
}
</script>

Basically this is copying the value from the 13th column in the grid (the hidden one) over to the 12th.  However, I need this to work in IE7/IE8, and the javascript function .getElementsByClassName is not supported.  So I tried replacing it with $(.igg_Summary') but that breaks my code completely.

Any ideas how I can use JQuery and cut out this javascript function all together?