this is my code::

TextBox[] tbArray = new TextBox[] { TextBox1, TextBox1, TextBox1 };


                for (int j = 0; j < tbArray.Length ; j++)
                {
                  
                        tbArray[j].Visible = true;
                     
                }

this code is success but only one textbox show not three textbox.. Can any one help me. Thanks

Recommended Answers

All 2 Replies

Check this in Page_Load event

if (!IsPostBack)
        {
            for (int i = 0; i < 3; i++)
            {
                TextBox txt = new TextBox();
                txt.ID = "txt" + i.ToString(); //or "txt" + pnlview.Controls.Count.ToString();
                pnlview.Wrap = true;
                pnlview.Controls.Add(txt);
                pnlview.ScrollBars = ScrollBars.Both;
            }
        }

#
write this
TextBox[] tbArray = new TextBox[] { TextBox1, TextBox2, TextBox3 };
#
#
instead of
TextBox[] tbArray = new TextBox[] { TextBox1, TextBox1, TextBox1 };
#

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.