We help IT Professionals succeed at work.
Get Started

Dynamically create controls in asp.net

pratikshahse asked
Last Modified: 2012-08-14
I am trying to create a list box dynamically in my code. There is a condition that needs to be true in order for listbox to be created. Can someone tell me how I can create the list box and then populate it with an array that I already have.

I have my code below
If APrompt.HasLOV = True Then
   ' create a dynamic listbox over here
   ' loop through the array and populate the listbox
    'create a dynamic textbox over here
end if

i do not have a codebehind file so everything is in my aspx page. also the above condition is being called multiple times so everytime a new listbox is created I need to give it a unique name. listbox1,listbox2,listbox3(i should be able to handle that part).

Open in new window

Watch Question
Top Expert 2010
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE