Instance name question

Posted on 2005-04-28
Medium Priority
Last Modified: 2010-04-07
I know what I want the end result to be, but I don't know how to explain it.

Basically I have 4 dropdownlists on my page and I'm trying to find to appropriate one to the number I give them.

They are named:

And I am going to have a loop and depending on where I am at in the count it will change that drop down. Like in the first loop I want to change categoryNo1, and in the 2nd loop I want to change categoryNo2, etc.

I'm sure you all know what I'm talking about, but I'm a simple java guy and don't know VB well enough.

Question by:abradley81
  • 3
LVL 23

Accepted Solution

b1xml2 earned 500 total points
ID: 13889234
Dim i As Integer
Dim list As DropDownList
For i = 1 To 4
      list = DirectCast(FindControl("categoryNo" & i),DropDownList)
LVL 23

Expert Comment

ID: 13889260
that'll get u the dropdownlist control,
LVL 23

Expert Comment

ID: 13889296
for(int i=0;i<4;i++)
      DropDownList list = FindControl("categoryNo" + (i + 1).ToString()) as DropDownList
      if (list != null)

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Watch the video to know how one can repair corrupt Exchange OST file effortlessly and convert OST emails to MS Outlook PST file format by using Kernel for OST to PST converter tool. It can convert OST to MSG, MBOX, EML to access them. It can migrate…

627 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