Data Binding ASP.Net Tutorial

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

    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        grdProducts.Visible = true;
    }
    protected void dtlProduct_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
    {
        txtTitle.Text = (string)e.Values["Title"];
        grdProducts.DataBind();
    }



    Show Empty Data Template


    
    

            id="txtTitle"
        Runat="server" />
            id="btnSubmit"
        Text="Search"
        OnClick="btnSubmit_Click"
        Runat="server" />
    
            id="grdProducts"
        DataSourceID="srcProducts"
        Visible="false"
        Runat="server">
        
        
        No matching products were found. 
        
                    id="dtlProduct"
            DataSourceID="srcProducts"
            DefaultMode="Insert"
            AutoGenerateInsertButton="true"
            AutoGenerateRows="false"
            Runat="server" 
            OnItemInserted="dtlProduct_ItemInserted">
            
                            HeaderText="Title:"
                DataField="Title" />
                            HeaderText="Director:"
                DataField="Director" />
            

        
        

    
            id="srcProducts"
        ConnectionString="<%$ ConnectionStrings:Products %>"
        SelectCommand="SELECT Title,Director FROM Products WHERE Title LIKE @Title+'%'"
        InsertCommand="INSERT Products (Title, Director)
            VALUES (@Title, @Director)"
        Runat="server">
        
                    Name="Title"
            ControlID="txtTitle"
            PropertyName="Text" />
        

    
    

    


File: Web.config

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