ADO Database ASP.Net

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



    Untitled Page


    
    

                                   runat="server" 
                           ProviderName="System.Data.SqlClient" 
                           ConnectionString="<%$ ConnectionStrings:Northwind %>" 
                           SelectCommand="SELECT EmployeeID, FirstName, LastName, TitleOfCourtesy, City FROM Employees" >
        
                              runat="server" 
                      DataSourceID="sourceEmployees" 
                      Font-Names="Verdana" 
                      Font-Size="Small" 
                      GridLines="Horizontal" 
                      AutoGenerateColumns="False" 
                      DataKeyNames="EmployeeID" 
                      EnableSortingAndPagingCallbacks="True" 
                      PageSize="5" 
                      HorizontalAlign="Justify" 
                      OnRowCreated="GridView1_RowCreated">
                                     BorderStyle="Solid" 
                         BorderWidth="2px" 
                         BackColor="Bisque" 
                         HorizontalAlign="Left" />
            
                                                HeaderText="ID" 
                                InsertVisible="False"
                                ReadOnly="True" 
                                SortExpression="EmployeeID" >
                    
                
                                                HeaderText="First Name" 
                                SortExpression="FirstName" >
                    
                
                                                HeaderText="Last Name" 
                                SortExpression="LastName" >
                    
                
                                                HeaderText="Title Of Courtesy" 
                                SortExpression="TitleOfCourtesy" >
                    
                
                
                    
                
            

        
    

    


File: GridViewFormattingEvents.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 GridViewFormattingEvents : System.Web.UI.Page
{
  protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
  {
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
      string title = (string)DataBinder.Eval(e.Row.DataItem, "TitleOfCourtesy");
      if (title == "Ms." || title == "Mrs.")
      {
        e.Row.BackColor = System.Drawing.Color.LightPink;
        e.Row.ForeColor = System.Drawing.Color.Maroon;
      }
      else if (title == "Mr.")
      {
        e.Row.BackColor = System.Drawing.Color.LightCyan;
        e.Row.ForeColor = System.Drawing.Color.DarkBlue;
      }
    }
  }
}
File: Web.config