title: Repeater Footer Total
body: <p>I'm a bit stumped as to why this isn't working, I may be doing something wrong.</p>
  
  <p>I have a repeater with values in the Amount column, I want to show the total of this column in the footer of the repeater.</p>
  
  <p>The problem is that the Total is always showing 0 and not adding the values of the rows up.</p>
  
  <p><strong>CODE BEHIND</strong></p>
  
  <pre><code>Protected Sub reCosts_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles reCosts.ItemDataBound
  
          Dim rowView As System.Data.DataRowView
          rowView = CType(e.Item.DataItem, System.Data.DataRowView)
  
          Dim CostsTotal As Decimal
  
          If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then
  
  
              Dim lCostAmount As Literal = CType(e.Item.FindControl("lCostAmount"), Literal)
              Dim CostAmount As Decimal = rowView("Amount")
              lCostAmount.Text = CostAmount.ToString("C2")
  
  
              CostsTotal += CostAmount
  
  
          ElseIf e.Item.ItemType = ListItemType.Footer Then
  
              Dim lCostsTotal As Literal = CType(e.Item.FindControl("lCostsTotal"), Literal)
              lCostsTotal.Text = CostsTotal.ToString("C2")
  
          End If
  
      End Sub
  </code></pre>
  
  <p>Any help would be appreciated.</p>
  
  <p>J.</p>