Gridview Footer Totals
Finally, we'll use Helper functions named GetUnitPrice and GetTotal to display the UnitPrice in the ItemTemplate and Total in the FooterTemplate. For instance, for each row of the GridView, a price value is passed to the GetUnitPrice function returning variable Price.
Listing 3: Using Helper Functions
decimal TotalUnitPrice; decimal GetUnitPrice(decimal Price) { TotalUnitPrice += Price; return Price; } decimal GetTotal() { return TotalUnitPrice; }