<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="cart.aspx.vb" Inherits="cart" title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<script runat="server">
Dim TotalUnitPrice As Decimal = 0.0
Function GetUnitPrice(ByVal Price As Decimal) As Decimal
TotalUnitPrice += Price
Return Price
End Function
Function GetTotal() As Decimal
Return TotalUnitPrice
End Function
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)

End Sub
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:Panel ID="Panel1" runat="server" Height="196px"
style="margin-bottom: 49px">
<asp:GridView ID="GridView1" runat="server" BackColor="White"
BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" CellPadding="3"
ForeColor="Black" GridLines="Vertical"

style="z-index: 1; left: 293px; top: 711px; position: absolute; height: 184px; width: 985px"
AutoGenerateColumns="False" DataKeyNames="OrderID"
DataSourceID="SqlDataSource1">
<Columns>
<asp:CommandField ShowDeleteButton="True" />
<asp:BoundField DataField="OrderID" HeaderText="OrderID" InsertVisible="False"
ReadOnly="True" SortExpression="OrderID" />
<asp:BoundField DataField="CusID" HeaderText="CusID" SortExpression="CusID" />
<asp:BoundField DataField="CusUsername" HeaderText="CusUsername"
SortExpression="CusUsername" />
<asp:BoundField DataField="ProductDesc" FooterText="Total" HeaderText="ProductDesc"
SortExpression="ProductDesc" />
<asp:BoundField DataField="TotalQuantity" HeaderText="Quantity"
SortExpression="TotalQuantity" />

<asp:TemplateField HeaderText="Unit Price" FooterStyle-Font-Bold="True">
<ItemTemplate>
<%#GetUnitPrice(Decimal.Parse(Eval("TotalPrice").ToString())).ToString("N2")%>
</ItemTemplate>
<FooterTemplate>
<%# GetTotal().ToString("N2") %>
</FooterTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#CCCCCC" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#CCCCCC" />
</asp:GridView>
</asp:Panel>
<p>
<asp:Label ID="lbltotal" runat="server" Text="Total:"></asp:Label>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:BookstoreConnectionString %>"
DeleteCommand="DELETE FROM OrderDetails WHERE (OrderID = @OrderID)"
SelectCommand="SELECT * FROM [OrderDetails]">
<DeleteParameters>
<asp:Parameter Name="OrderID" />
</DeleteParameters>
</asp:SqlDataSource>
&nbsp;
</p>
<p>
</p>
</asp:Content>

I just added the show footer,
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="true" ShowFooter= "true" BackColor="White" .....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.