ADO Database ASP.Net

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="GridViewSummaries" %>



    Untitled Page


    
                                   runat="server" ConnectionString="<%$ ConnectionStrings:Northwind %>"
                           ProviderName="System.Data.SqlClient" 
                           SelectCommand="SELECT ProductID, ProductName, UnitPrice, UnitsInStock FROM Products">
        
                              runat="server" 
                      AutoGenerateColumns="False" 
                      CellPadding="4"
                      DataKeyNames="ProductID" 
                      DataSourceID="sourceProducts" 
                      Font-Names="Verdana" 
                      Font-Size="Small" 
                      ForeColor="Black" 
                      GridLines="None" 
                      AllowPaging="True" 
                      OnDataBound="GridView1_DataBound" 
                      ShowFooter="True">
            
            
            
            
            
            
            
                                    SortExpression="ProductID" />
                
                                    SortExpression="UnitPrice" />
                
            

        
    

    


File: Default.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class GridViewSummaries : System.Web.UI.Page
{
  protected void GridView1_DataBound(object sender, EventArgs e)
  {
    decimal valueInStock = 0;
        foreach (GridViewRow row in GridView1.Rows)
        {
      decimal price = Decimal.Parse(row.Cells[2].Text.Substring(1));
      int unitsInStock = Int32.Parse(row.Cells[3].Text);
      valueInStock += price * unitsInStock;
        }
    GridViewRow footer = GridView1.FooterRow;
    
    footer.Cells[0].ColumnSpan = 3;
    footer.Cells[0].HorizontalAlign = HorizontalAlign.Center;
    footer.Cells.RemoveAt(2);
    footer.Cells.RemoveAt(1);
    footer.Cells[0].Text = "Total value in stock (on this page): " + valueInStock.ToString("C");
  }
}
File: Web.config