Looping thru all DDL on a form, checking for value

J

Jim in Arizona

Using VB ..

Is there a way to loop through all drop down lists on a web form
checking for a specific value (ddlDropDown.SelectedValue) and then,
based on that value, cause a specific label to go visible or not?

Thanks,
Jim
 
B

bruce barker \(sqlwork.com\)

recursivly loop thru all controls checking the type.

aircode:

LoopThruControls(this);

void LoopThruControls(Control ctl)
{
DropDownList ddl = ctl as DropDownList;
if (ddl !=null)
{
// do somthing with selected value
}
foreach (Control child in ctl.Controls)
{
LoopThruControls(child);
}
}

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top