How do I sum only the columns that are in the grid after it has been filtered? I can only seem to get the sum of all of the values for the column before it was filtered.
After the filter has been performed and the datasource set and the grid rebound, I have the followjng code which loops through the grid and sums the column. But it always shows the sum of all rows from the original datasource and not the filtered rows:
Any help would be appreciated!
Thanks
After the filter has been performed and the datasource set and the grid rebound, I have the followjng code which loops through the grid and sums the column. But it always shows the sum of all rows from the original datasource and not the filtered rows:
For Each item As GridDataItem In rgT.MasterTableView.Items
lblAmt =
CType(item.FindControl("lblTransAmount"), Label)
Try
transTotal += System.Convert.ToDouble(Replace(lblAmt.Text,
"$", ""))
Catch ex As Exception
lblUpdMsg.Text =
"There was an error summing the transactions. " & ex.Message
Exit For
End Try
Next
Any help would be appreciated!
Thanks