Is it possible to create textbox dynamically?

Posted on 2009-02-08
Last Modified: 2013-12-17
i would like to create textbox based on how many items i have in my arraylist. is it possible? so like if i have 5 item there should only be 5 box or if i have 10 should only be 10. etc... is it possible?i tried creating box like this as a test:

        TextBox newbox = new TextBox();
        newbox.ID = "newbox";
        newbox.Text = "hi";
        newbox.TextMode = TextBoxMode.MultiLine;

but it gives an error since i didnt add the label in my aspx file, but i dont know how many boxes i will have to add there. is what i am doing possible?

Question by:Raul77
    LVL 26

    Expert Comment

    by:Anurag Thakur
    yes you can definitely create dynamic text boxes
    look at the following link from microsoft

    Author Comment

    thanks but the code is if you know how many box you will have, can you show me a simple example if you dont know how many text boxes you will have?
    LVL 29

    Accepted Solution

    LVL 26

    Expert Comment

    by:Anurag Thakur

    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
    The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now