Data Binding ASP.Net Tutorial

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


    Record Editor


    
    

                                  runat="server" 
                          AutoPostBack="True" 
                          Width="300px" 
                          DataSourceID="sourceProducts" 
                          DataTextField="ProductName" 
                          DataValueField="ProductID">
        
        
        
            
                
                
                
            

        

                                                         runat="server" 
                                     DataSourceID="sourceProductDetails"
                                     Height="50px" 
                                     Width="200px" 
                                     AutoGenerateEditButton="True">
                    
                

                                   runat="server"
                           ProviderName="System.Data.SqlClient"
                           ConnectionString="<%$ ConnectionStrings:Northwind %>"
                           SelectCommand="SELECT ProductName, ProductID FROM Products"/>
                                     runat="server"
                            ProviderName="System.Data.SqlClient"
                            ConnectionString="<%$ ConnectionStrings:Northwind %>"
                            SelectCommand="SELECT ProductID, ProductName, UnitPrice, UnitsInStock, UnitsOnOrder, ReorderLevel, Discontinued FROM Products WHERE ProductID=@ProductID"
                            UpdateCommand="UPDATE Products SET ProductName=@ProductName, UnitPrice=@UnitPrice, UnitsInStock=@UnitsInStock, UnitsOnOrder=@UnitsOnOrder, ReorderLevel=@ReorderLevel, Discontinued=@Discontinued WHERE ProductID=@ProductID AND ProductName=@original_ProductName AND UnitPrice=@original_UnitPrice AND UnitsInStock=@original_UnitsInStock AND UnitsOnOrder=@original_UnitsOnOrder AND ReorderLevel=@original_ReorderLevel AND Discontinued=@original_Discontinued"
                            OldValuesParameterFormatString="original_{0}" ConflictDetection="CompareAllValues" OnUpdated="sourceProductDetails_Updated">
           
              
           

        
        
    

    


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 MyPage : System.Web.UI.Page
{
    protected void sourceProductDetails_Updated(object sender, SqlDataSourceStatusEventArgs e)
    {
        if (e.AffectedRows == 0)
        {
            lblInfo.Text = "No update was performed. A concurrency error is likely, or the command is incorrectly written.";
        }
        else
        {
            lblInfo.Text = "Record successfully updated.";
        }
    }
}
File: Web.config