title: Object reference not set to an instance of an object. : grid view inside repeater
body: <p>gridview is placed in repeater,
  it is showing error on itemdata bound</p>
  
  <p>code,</p>
  
  <pre><code>  &lt;asp:Repeater ID="rptSearchResult" runat="server" 
                  OnItemDataBound="rptSearchResult_ItemDataBound"&gt;
            &lt;HeaderTemplate&gt;
           &lt;table border="0"&gt;
               &lt;tr&gt;
                   &lt;td&gt; Cost Page&lt;/td&gt;
                   &lt;td&gt; Cost Page Description&lt;/td&gt;
                   &lt;td&gt; Vendor Name&lt;/td&gt;
                   &lt;td&gt; Bill Type&lt;/td&gt;
               &lt;/tr&gt;
        &lt;/HeaderTemplate&gt;
  
        &lt;ItemTemplate&gt;
           &lt;tr&gt;
              &lt;td&gt; &lt;%# Eval("CostPage")%&gt;&lt;/td&gt;
                 &lt;td&gt;&lt;%# Eval("CostPageDescription")%&gt; &lt;/td&gt;
                 &lt;td&gt; &lt;%# Eval("VendorName")%&gt; &lt;/td&gt;
                 &lt;td&gt;&lt;%# Eval("BillType")%&gt; &lt;/td&gt;
           &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td&gt;
                 &lt;asp:GridView ID="gvDetails" runat="server" &gt;
                     &lt;Columns&gt;  
                       &lt;asp:TemplateField HeaderText=""&gt;
                       &lt;ItemTemplate&gt; 
                           &lt;asp:CheckBox ID="chkSelect" runat="server" /&gt;
                       &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;              
                       &lt;asp:BoundField DataField="ItemId" HeaderText="Item ID"/&gt;                    
                       &lt;asp:BoundField DataField="ItemDescription"  HeaderText="Item Description"/&gt;
                       &lt;asp:BoundField DataField="BrandCode"   HeaderText="Brand Code"/&gt;                    
  
                      &lt;/Columns&gt; 
  
                 &lt;/asp:GridView&gt;  &lt;/td&gt;
           &lt;/tr&gt;
        &lt;/ItemTemplate&gt;
  
        &lt;FooterTemplate&gt;
           &lt;/table&gt;
        &lt;/FooterTemplate&gt;
  
          &lt;/asp:Repeater&gt;
  </code></pre>
  
  <p>in .cs file,</p>
  
  <pre><code>    protected void rptSearchResult_ItemDataBound(
         object sender, RepeaterItemEventArgs e)
      {
          GridView gd = (GridView)e.Item.FindControl("gvDetails");
  
  
          details e1 = new details();
          e1.itemid= 1;
          e1.itemdesc = "item1";
          e1.brandcode = "BBB";
  
          List&lt;details&gt; employees = new List&lt;details&gt;();
          employees.Add(e1);
  
          gd.DataSource = employees;
          gd.DataBind();
  </code></pre>
  
  <p>}</p>