title: Get div control by name from codebehind
body: <p>Ok, I want to access div control by id witch is changed dynamically from C# code. Maybe it will be clearer with code:</p>
  
  <pre><code>string divHtml = "";
          for (int j = 1; j &lt; 4; j++)
          {
              string ph = "placeHolder" + j;
  
              Control phd = (Control)FindControl(ph);
              StringWriter sw = new StringWriter();
              HtmlTextWriter w = new HtmlTextWriter(sw);
              phd.RenderControl(w);
              divHtml = divHtml + sw.GetStringBuilder().ToString();
          }
  </code></pre>
  
  <p>and ascx part is:</p>
  
  <pre><code>&lt;div runat="server" id="placeHolder1" class="placeholder" &gt;                
  &lt;/div&gt;
  </code></pre>
  
  <p>It pass compile time but phd is at <strong>null value</strong>, not to the value of control. It works fine if i access control directly like this:</p>
  
  <pre><code>StringWriter sw = new StringWriter();
  HtmlTextWriter w = new HtmlTextWriter(sw);
  placeHolder1.RenderControl(w);
  divHtml = divHtml + sw.GetStringBuilder().ToString();
  </code></pre>
  
  <p>Thank you in advance....</p>