title: e.Row.findcontrol() returns null after databind but all databound fields work properly
body: <p>I am trying to get a gridview to populate text from the database call to my Label as shown
   The Results have been tested and are returning the correct names</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      DataTable t = DBProductLink.ListWithOptions(ProductId, LinkType, null);
      TestList.DataSource = t ;
      TestList.DataBind();
  }
  </code></pre>
  
  <p>The labels are created in the Gridview like this:</p>
  
  <pre><code>&lt;asp:GridView ID="TestList" runat="server" OnRowDataBound="testDataBound" AutoGenerateColumns="false" DataKeyNames="Id"&gt;
      &lt;Columns&gt;
          &lt;asp:TemplateField HeaderText="Sizes"&gt;
              &lt;asp:ItemTemplate&gt;
                  &lt;asp:Label ID="sizeLabel" runat="server" Text='&lt;%# Eval("size") %&gt;' /&gt;
              &lt;/asp:ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
      &lt;/Columns&gt;
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>I then tried to loop through the gridview and access the label using the ondatarowbound, however in this it is null.</p>
  
  <pre><code>protected void testDataBound(object sender, GridViewRowEventArgs e)
  {
      if (e.Row.RowType != DataControlRowType.DataRow)
          return;
  
      Label sizeLabel = e.Row.FindControl("sizeLabel") as Label;
      sizeLabel.Text = "test";
  }
  </code></pre>
  
  <p>I am using the exact same set up with 2 drop boxes and 2 labels on another gridview with a different name on the same page which is not having this problem. Anyone got an idea on this?
  The other Gridview is as follows:</p>
  
  <pre><code>&lt;asp:GridView ID="SearchList" runat="server" AutoGenerateColumns="False"
      DataKeyNames="Id"  OnRowDataBound="SearchList_RowDataBound"
      OnRowCommand="SearchList_RowCommand" Width="100%"  PageSize="20" &gt;
      &lt;Columns&gt;
          &lt;asp:BoundField DataField="Code" HeaderText="Code" SortExpression="Code" /&gt;
          &lt;asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" /&gt;
          &lt;asp:TemplateField HeaderText="Price" SortExpression="Price"&gt;
              &lt;ItemTemplate&gt;
                  &lt;robo:MoneyLabel ID="MoneyLabel2" runat="server" 
                      Value='&lt;%# Eval("Price") %&gt;' /&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="Type"&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Label ID="typeLabel" runat="server" Text='&lt;%# Eval("Type") %&gt;' /&gt;
                  &lt;asp:HiddenField ID="productId" runat="server" Value='&lt;%# Eval("Id") %&gt;' /&gt;
                  &lt;asp:HiddenField ID="isFabric" runat="server" Value='&lt;%# Eval("IsFabric") %&gt;' /&gt;
                  &lt;asp:HiddenField ID="isOldWizard" runat="server" Value='&lt;%# Eval("IsOldWizard") %&gt;' /&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="Options/Color/Size"&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:LinkButton runat="server" ID="GetOptions" Text="Get Options" CausesValidation="false" CommandName="Options"  /&gt;
                  &lt;asp:Label ID="OptionLabel" Visible="false" runat="server" Text="Option: " /&gt;
                  &lt;asp:DropDownList ID="ProductOptions" runat="server" Visible="false" /&gt;
                  &lt;asp:Label ID="ColorLabel" Visible="false" runat="server" Text="Color: "  /&gt;
                  &lt;asp:DropDownList  ID="RibbonColors" runat="server" Visible="false" AutoPostBack="true" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
                  &lt;asp:Label ID="SizeLabel" Visible="false" runat="server" Text="Size: " /&gt;
                  &lt;asp:DropDownList ID="RibbonSizes" runat="server" Visible="false" AutoPostBack="true"  /&gt;
              &lt;/ItemTemplate&gt;
              &lt;ItemStyle HorizontalAlign="Center" /&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="Add"&gt;
              &lt;ItemStyle Width="60px" /&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:LinkButton ID="LinkButton1" runat="server" Text="Add" CommandName="Add" CommandArgument='&lt;%# Eval("Id") %&gt;' /&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
      &lt;/Columns&gt;
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>.cs is </p>
  
  <pre><code>protected void SearchList_RowDataBound(object sender, GridViewRowEventArgs e)
  {
      if (e.Row.RowType != DataControlRowType.DataRow)
          return;
      int productId = (int)SearchList.DataKeys[e.Row.RowIndex].Value;
      LinkButton GetOptions = e.Row.FindControl("GetOptions") as LinkButton;
      DropDownList RibbonColors = e.Row.FindControl("RibbonColors") as DropDownList;
      DropDownList  RibbonSizes = e.Row.FindControl("RibbonSizes") as DropDownList;
      DropDownList ProductOptions = e.Row.FindControl("ProductOptions") as DropDownList;
      Label typeLabel = e.Row.FindControl("typeLabel") as Label;
      HiddenField isFabric = e.Row.FindControl("isFabric") as HiddenField;
      HiddenField isOldWizard = e.Row.FindControl("isOldWizard") as HiddenField;
  
      ProductType typeValue = DBConvert.ToEnum&lt;ProductType&gt;(typeLabel.Text);
      bool isFabricValue = Convert.ToBoolean(isFabric.Value.ToString());
      bool isOldWizardValue = Convert.ToBoolean(isOldWizard.Value.ToString());       
  }
  </code></pre>