ASP.NET:finding html controls in server side afther adding them programmitcly
<p>im trying to do somthing and got into a problem.</p>

<p>i got a function that adding html elements and thire attributes.
now, i want to get the controls in server side (code behind) so i can do some stuff with them.</p>

<p>my problem is:
   i cant "find" them.</p>

<p>this is part of the function im using to add them, its a bit longer so i show only the controls i want to get in the server side:</p>

<pre><code> public string EditPhoto(int x)
{
    using (StringWriter stringWriter = new StringWriter())
    {
        using (HtmlTextWriter writer = new HtmlTextWriter(stringWriter))
        {
            // Some strings for the attributes.
           string classValue = "thumb";

            //Begin #5 &lt;div class=image-title"&gt;
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "image-title");
            writer.AddAttribute("runat", "server"); //--&gt; server side att
            writer.AddAttribute(HtmlTextWriterAttribute.Id, "title" + x);
            writer.RenderBeginTag(HtmlTextWriterTag.Input);
            TextWriter innerTextWriter = writer.InnerWriter;
            innerTextWriter.Write(title);
            writer.RenderEndTag(); //#End 5 &lt;/div&gt;


            //Begin #6 &lt;div class="image-desc"&gt;
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "image-desc");
            writer.AddAttribute("runat", "server"); //--&gt; server side att
            writer.AddAttribute(HtmlTextWriterAttribute.Id, "desc" + x);
            writer.RenderBeginTag(HtmlTextWriterTag.Input);
            innerTextWriter = writer.InnerWriter;
            innerTextWriter.Write(descreption);
            writer.RenderEndTag(); //#End 6 &lt;/div&gt;

            writer.RenderEndTag();//#End 4 &lt;/div&gt;
            writer.RenderEndTag(); // End #1 &lt;/li&gt;

        }
        // Return the result.
        return stringWriter.ToString();
    }
</code></pre>

<p>afther the function is done i got this Test code to try and look for them:</p>

<pre><code>for (int i = 0; i &lt; Controls.Count; i++)
    {

    if (FindControl("title" + i) != null)
        Response.Write("Found 1 title control");
    else
        Response.Write( i +"There is no control");
    }

        for (int i = 0; i &lt; Controls.Count; i++)
        {

            if (FindControl("desc" + i) != null)
                Response.Write("Found 1 descreption control");
            else
                Response.Write(i + "Thre is no control");
        }
</code></pre>

<p>sorry for my english   </p>
