adding textboxes to panel in modal popup
<p>How can I dynamically add text boxes to a Panel in a modal popup? I am trying this so far with no luck....</p>

<p>There is a gridview that pops up a modal panel where I would like to dynamically add textboxes.</p>

<p>UPDATED CODE IN FOR LOOP:</p>

<pre><code>int num = 4;
int I;
// Create TB's
for (I = 1; I &lt;= num; I++)
{
        Panel newPanel = (Panel)Page.Master.FindControl("pnlpopup");
        PlaceHolder MainContent2 = (PlaceHolder)newPanel.FindControl("PlaceHolder3");

        TextBox txtB = new TextBox();
        txtB.ID = "txtBEdit" + I.ToString("D2");
        MainContent2.Controls.Add(txtB);
}

this.ModalPopupExtender.Show();here
</code></pre>

<p>This is the aspx.</p>

<pre><code>&lt;asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"&gt;
&lt;/asp:ToolkitScriptManager&gt;

&lt;asp:ModalPopupExtender ID="ModalPopupExtender" runat="server" TargetControlID="btnShowPopup" PopupControlID="pnlpopup" CancelControlID="btnCancel" BackgroundCssClass="modalBackground"&gt;
&lt;/asp:ModalPopupExtender&gt;

&lt;asp:Label ID="lblresult" runat="server"/&gt;
&lt;asp:Button ID="btnShowPopup" runat="server" style="display:none" /&gt;
&lt;asp:Panel ID="pnlpopup" runat="server" BackColor="White" Height="650px" 
    Width="500px" Font-Size="Small"&gt;
&lt;table width="100%" style="border:Solid 3px #D55500; width:100%; height:100%" cellpadding="1" cellspacing="1"&gt;
    &lt;tr style="background-color:#D55500"&gt;
    &lt;td colspan="2" style=" height:10%; color:White; font-weight:bold; font-size:larger" align="center"&gt;Foreign Text Input&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td align="left" style=" width:20%"&gt;ID:
        &lt;/td&gt;
        &lt;td&gt;
            &lt;asp:Label ID="lblID" runat="server"&gt;&lt;/asp:Label&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td align="left"&gt;English text:
        &lt;/td&gt;
        &lt;td&gt;
           &lt;asp:Label ID="data_text" runat="server"&gt;&lt;/asp:Label&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;
        &lt;asp:PlaceHolder ID="PlaceHolder3" runat="server"&gt;&lt;/asp:PlaceHolder&gt;


        &lt;!--Textboxes will be added here --&gt;


        &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;
        &lt;/td&gt;
        &lt;td&gt;
            &lt;asp:Button ID="btnUpdate" CommandName="Update" runat="server" Text="Update" onclick="btnUpdate_Click"/&gt;
            &lt;asp:Button ID="btnCancel" runat="server" Text="Cancel" /&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;
&lt;/asp:Panel&gt;
&lt;/div&gt;
&lt;/asp:Content&gt;
</code></pre>

<p>To provide the solution I am adding the below line of code....</p>

<pre><code>PlaceHolder MainContent2 = (PlaceHolder)PlaceHolder3.FindControl("PlaceHolder3");
</code></pre>
