If you are using ASP.NET1.1, and you want a subtotal by page, then one way of
doing it would be to set the ShowFooter="True"on the datagrid and then to
calculate the page subtotal during the ItemDataBound event, e.g.
<asp
ataGrid ID="datagrid1" Runat="server" AutoGenerateColumns="False"
AllowPaging="True" PageSize="5" ShowFooter="True" >
<Columns>
<asp:TemplateColumn HeaderText="Sale Price">
<ItemTemplate >
<asp:Label id="lblSalePrice" Runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "SalePrice")%>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:Label ID="lblTotal" Runat="server"></asp:Label>
</FooterTemplate>
</asp:TemplateColumn>
</Columns>
</asp
ataGrid>
Private Sub DG_ItemDataBound(ByVal sender As Object, ByVal e As _
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
datagrid1.ItemDataBound
If (e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem) Then
TotalSales += CType(e.Item.DataItem, DataRowView)("SalePrice")
End If
If ((e.Item.ItemType = ListItemType.Footer)) Then
Dim lbl As Label = CType(e.Item.FindControl("lblTotal"), Label)
If Not lbl Is Nothing Then
lbl.Text = "Total " & TotalSales.ToString("$#.00")
End If
End If
End Sub