Datagrid summary row in Template Column

I would like to display a summary row in a template column. The following code works with a simple bound column but not with a template column. How do I convert?

PrivateSub dg_ItemDataBound(ByVal senderAsObject,ByVal eAs System.Web.UI.WebControls.DataGridItemEventArgs)Handles dg.ItemDataBound

SelectCase e.Item.ItemType

Case ListItemType.AlternatingItem, ListItemType.Item

myTotal += CDbl(e.Item.Cells(13).Text)

e.Item.Cells(13).Text = Format(myTotal, "##,##0.00")

e.Item.Cells(13).Attributes.Add("align", "right")

Case ListItemType.Footer

e.Item.Cells(1).Text = "Division Total"

e.Item.Cells(1).Attributes.Add("align", "right")

e.Item.Cells(13).Attributes.Add("align", "right")

e.Item.Cells(13).Text = myTotal.ToString("n")

EndSelect

EndSub

[2214 byte] By [JayatMed] at [2007-12-16]

.NET Development

Site Classified