Data Binding ASP.Net Tutorial

<%@ Page Language="C#" %>
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


    Master/Detail


    
    

                    ID="lstProductCategories"
            DataSourceId="srcProductCategory"
            DataKeyNames="Id"
            runat="server">
            
                
                                    id="itemPlaceholder"
                    Runat="server" />
                

            
            
                

                                    id="lnkSelect"
                    Text='<%# Eval("Name") %>'
                    CommandName="Select"
                    Runat="server" />
                

            

            
                
                <%# Eval("Name") %>
                

            
        
        
                    ID="lstProducts"
            DataSourceId="srcProducts"
            runat="server">
            
                

                                        id="itemPlaceholder"
                        runat="server" />
                    

            

            
                
  • <%# Eval("Title") %>

  •             

            
                        id="srcProductCategory"
                SelectCommand="SELECT Id, Name FROM ProductCategory"
                ConnectionString='<%$ ConnectionStrings:con %>'
                Runat="server" />
                        id="srcProducts"
                SelectCommand="SELECT Title FROM Product
                    WHERE CategoryId=@CategoryId"
                ConnectionString='<%$ ConnectionStrings:Products %>'
                Runat="server">
                
                                        Name="CategoryId"
                        ControlID="lstProductCategories" />
                

            
        

        


    File: Web.config

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