M
Mike
Hello,
I have a recursive method that looks through an ASP.Net page to find a
control by ID. My problem is after it finds the control, breaks from the
loop and returns the control, it goes to my recursive line (if
control.HasControls call the findctl method). I think the problem lies in
that the method returns a value. Is this the case? Any ideas?
Thanks
private Control FindCtl(Control oControl, string controlID)
{
Control control = new Control();
foreach (Control ctl in oControl.Controls)
{
if (ctl.ID == controlID)
{
control = ctl;
break;
}
if (ctl.HasControls())
{
FindCtl(ctl, controlName);
}
}
return control;
}
I have a recursive method that looks through an ASP.Net page to find a
control by ID. My problem is after it finds the control, breaks from the
loop and returns the control, it goes to my recursive line (if
control.HasControls call the findctl method). I think the problem lies in
that the method returns a value. Is this the case? Any ideas?
Thanks
private Control FindCtl(Control oControl, string controlID)
{
Control control = new Control();
foreach (Control ctl in oControl.Controls)
{
if (ctl.ID == controlID)
{
control = ctl;
break;
}
if (ctl.HasControls())
{
FindCtl(ctl, controlName);
}
}
return control;
}