LINQ ASP.Net Tutorial

File: ~\App_Code\Product.cs
using System;
using System.Data.Linq.Mapping;
[Table]
public class Product
{
    [Column(IsPrimaryKey=true, IsDbGenerated=true)]
    public int Id { get; set; }
    [Column]
    public string Title { get; set; }
    [Column]
    public string Director { get; set; }
    [Column]
    public DateTime DateReleased { get; set; }
    [Column]
    public decimal Totals { get; set; }
}
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Web.Configuration" %>
<%@ Import Namespace="System.Linq" %>
<%@ Import Namespace="System.Data.Linq" %>
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    protected void btnSearch_Click(object sender, EventArgs e)
    {
        string conString = WebConfigurationManager.ConnectionStrings["Products"] .ConnectionString;
        DataContext db = new DataContext(conString);
        var tProduct = db.GetTable();
        grdProducts.DataSource = tProduct.Where( m => m.Director.Contains(txtDirector.Text) );
        grdProducts.DataBind();
    }





    
    

            id="lblDirector"
        Text="Director:"
        AssociatedControlID="txtDirector"
        Runat="server" />
            id="txtDirector"
        Runat="server" />
            id="btnSearch"
        Text="Search"
        OnClick="btnSearch_Click"
        Runat="Server" />
            id="grdProducts"
        Runat="server" />
    

    


File: Web.config

  
             connectionString="Data Source=.\SQLEXPRESS;
         AttachDbFilename=|DataDirectory|MyDatabase.mdf;Integrated Security=True;User Instance=True" />