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 7749623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:05:22+00:00 2026-06-01T11:05:22+00:00

I want to create 5 text boxes created on drop down selected index change

  • 0

I want to create 5 text boxes created on drop down selected index change and 4 text boxes created if dropdown index is 4. dropdown is inside asp.net updatepanel. There is a button as well inside update panel. When user will click that button, whatever is typed in textboxes, is shown on label.

Please suggest me solution.

  • 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-06-01T11:05:23+00:00Added an answer on June 1, 2026 at 11:05 am

    May this work

        <div>
    
    </div><asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:Panel ID="Panel1" runat="server">
    
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
     <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" 
            onselectedindexchanged="DropDownList1_SelectedIndexChanged"><asp:ListItem Value="1">one </asp:ListItem><asp:ListItem Value="2">Two </asp:ListItem><asp:ListItem Value="3">Three </asp:ListItem><asp:ListItem Value="4">Four</asp:ListItem>
        </asp:DropDownList>
     <br />
       <asp:Button ID="Button2" runat="server" Text="fectchText" onclick="Button2_Click" />
        <br />
    
        <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
        <br />
        <br />
        <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
    </ContentTemplate>
    

        protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack)
        {
            if (ViewState["mode"].ToString() == "1")
                createTextbox();
            ViewState.Add("mode", "1");
        }
        else
        {
            ViewState.Add("mode", "0");
        }
    }
    
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        createTextbox();
    }
    
    public void createTextbox()
    {
        int noOftextbox = Convert.ToInt32(DropDownList1.SelectedItem.Value);
        for (int i = 0; i < noOftextbox; i++)
        {
            TextBox txtbox = new TextBox();
            txtbox.ID = "txt" + i;
            txtbox.Visible = true;
            txtbox.Height = 30;
            txtbox.Width = 100;
            UpdatePanel1.ContentTemplateContainer.Controls.Add(txtbox);
            PlaceHolder1.Controls.Add(txtbox);
         }
    }
    
    protected void Button2_Click(object sender, EventArgs e)
    {
        int nocount=    Convert.ToInt32(DropDownList1.SelectedItem.Value);
        for (int count = 0; count <= nocount-1 ; count++)
        {
         TextBox txtRead = (TextBox)PlaceHolder1.FindControl("txt" + (count));
         Label1.Text += txtRead.Text+"-";
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a fading effect of text in Label control. I change
I want to create super script for desired text selected by user. I found
I'm creating a login page. I want to create ASP.NET TextBox controls that have
Hello I'm trying to create text boxes dynamically using for loop and want to
I want to create a form that contains text boxes as follow. I am
I have a form with a number of text boxes. I want to create
I want to create a form which has a text entry box where a
I want to create a dialog that contains some kind of text element (JLabel/JTextArea
I want to create a generic method to serizlize a class to text (for
I want to create a PHP app that can send text messages ; There

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.