Data Binding ASP.Net






    Untitled Page


    
    

                              Runat="server" 
                      DataSourceID="SqlDataSource1"
                      DataKeyNames="CustomerID" 
                      AutoGenerateColumns="False">
            
                                                HeaderText="CustomerID"
                                DataField="CustomerID"
                                SortExpression="CustomerID"/>
                                                DataField="CompanyName"
                                SortExpression="CompanyName"/>
                                                DataField="ContactName"
                                SortExpression="ContactName"/>
                                                DataField="ContactTitle"
                                SortExpression="ContactTitle"/>
                                                DataField="Address"
                                SortExpression="Address"/>
                                                DataField="City"
                                SortExpression="City"/>
                                                DataField="Region"
                                SortExpression="Region"/>
                                                DataField="PostalCode"
                                SortExpression="PostalCode"/>
                                                DataField="Country" 
                                SortExpression="Country"/>
                                                DataField="Phone" 
                                SortExpression="Phone"/>
                                                DataField="Fax" 
                                SortExpression="Fax"/>
            

        
                                   Runat="server"
                           SelectCommand="SELECT * FROM [Customers]" 
                           ConnectionString="<%$ ConnectionStrings:AppConnectionString1 %>"
                           DataSourceMode="DataSet"
                           ConflictDetection="CompareAllValues" EnableCaching="True"
                           CacheKeyDependency="MyKey" 
                           CacheDuration="Infinite">
        
    

    


File: Web.config

  
  
                     connectionString="Data Source=localhost\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True"
             providerName="System.Data.SqlClient" />