title: Cannot access control inside DetailsView Edit template
body: <p>Hello everybody and thanks in advance,</p>
  
  <p>Well, I have a DetailsView in my .aspx file and I can't access to a CheckBoxList control placed in the DetailsView's edit template. I've read a lot of threads about this but still can't find a solution. Here's the code...</p>
  
  <pre><code> &lt;asp:DetailsView ID="MyDetailsView" runat="server" Height="50px" Width="125px" AutoGenerateRows="False" DataSourceID="DataMyDetailsView"&gt;
      ...
      ...
      &lt;asp:TemplateField HeaderText="DATA" SortExpression="DATA"&gt;
          &lt;EditItemTemplate&gt;
              &lt;div style="width:400px; height:300px; overflow-y:auto"&gt;
                  &lt;asp:CheckBoxList ID="DataCL" runat="server" DataSourceID="DataEDIT" DataTextField="DATA" DataValueField="ID_DATA"&gt;
                  &lt;/asp:CheckBoxList&gt;
              &lt;/div&gt;
  </code></pre>
  
  <p>Then, in my .cs file I have this piece of code...</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
  
      if (!IsPostBack)
      {
          // Do something
      }
      else
      {
          CheckItems();
      }
   }
  
  ...
  ...
  
  public void CheckItems()
  {
      CheckBoxList DataCL = (CheckBoxList)MyDetailsView.FindControl("DataCL");
  
      using (conexion)
      {
          conexion.Open();
          cmd.Connection = conexion;
  
          DataSet ds = new DataSet();
          string cmdstr = "SELECT * FROM DATA";
          SqlDataAdapter adp = new SqlDataAdapter(cmdstr, conexion);
          adp.Fill(ds);
          DataCL.DataSource = ds;
          DataCL.DataTextField = "DATA";
          DataCL.DataValueField = "ID_DATA";
          DataCL.DataBind();
  </code></pre>
  
  <p>The problem is that when the execution reaches the first line in which the control is called (DataCL.DataSource = ds;), a "NullPointerExeception" is thrown, however I can access easily to controls in ItemTemplate.</p>
  
  <p>Please, can someone help me in this. Thanks again!</p>