Looping thru all DDL on a form, checking for value

  • Thread starter Thread starter Jim in Arizona
  • Start date Start date
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
 
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)
 
Back
Top