Ok, I want to access div control by id witch is changed dynamically from C# code. Maybe it will be clearer with code:
string divHtml = "";
for (int j = 1; j < 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();
}
and ascx part is:
<div runat="server" id="placeHolder1" class="placeholder" >
</div>
It pass compile time but phd is at null value, not to the value of control. It works fine if i access control directly like this:
StringWriter sw = new StringWriter();
HtmlTextWriter w = new HtmlTextWriter(sw);
placeHolder1.RenderControl(w);
divHtml = divHtml + sw.GetStringBuilder().ToString();
Thank you in advance....