Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6699881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:44:55+00:00 2026-05-26T06:44:55+00:00

How can I dynamically add text boxes to a Panel in a modal popup?

  • 0

How can I dynamically add text boxes to a Panel in a modal popup? I am trying this so far with no luck….

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

UPDATED CODE IN FOR LOOP:

int num = 4;
int I;
// Create TB's
for (I = 1; I <= 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

This is the aspx.

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<title>Untitled Page</title>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>

<asp:ModalPopupExtender ID="ModalPopupExtender" runat="server" TargetControlID="btnShowPopup" PopupControlID="pnlpopup" CancelControlID="btnCancel" BackgroundCssClass="modalBackground">
</asp:ModalPopupExtender>

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


        <!--Textboxes will be added here -->


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

To provide the solution I am adding the below line of code….

PlaceHolder MainContent2 = (PlaceHolder)PlaceHolder3.FindControl("PlaceHolder3");
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:44:56+00:00Added an answer on May 26, 2026 at 6:44 am

    Since PlaceHolder3 is an

    <asp:PlaceHolder ID="PlaceHolder3" runat="server"></asp:PlaceHolder>
    

    you should be able to access it via this.PlaceHoder3 directly. If not, then add

    protected PlaceHolder PlaceHolder3;
    

    to your class definition.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to make a make generic select control that I can dynamically add elements
Is there a way in android app that we can add some text or
I have a page where the user can dynamically add file upload boxes. Adding
I'm trying to add a text field to a form dynamically using javascript. From
From what I used in Telerik's GridView control, I can dynamically add a column
How can I validate dynamically created text inputs? I have an add more link
In Java, I can dynamically add stuff to classpath and load classes (dynamically meaning
Im a VB.NET beginnger, can anyone tell me how I can dynamically add a
how can you dynamically add items to a combobox using the datagridview virtual mode?
Can we add the items in the combobox located on the window form dynamically

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.