Dear all,
before using AJAX.Net, when I wanted to find control in form,
I used this code

Dim SQL As String = "SELECT CurrencyID, CurrencyID FROM MasterCurrency ORDER BY CurrencyID"
 Dim ctl As Object

 For Each ctl In Me.FindControl("form1").Controls
     If LCase(Left(ctl.id, 6)) = "cmbccy" Then FillControl(ctl, SQL)
 Next

now, after I'm implementing AJAX.Net, ASP.Net couldn't find all controls inside UpdatePanel.
ASP.Net only finds UpdatePanel control

Does any one know how to find controls inside UpdatePanel?

Thanks

noorashegh commented: this solution work for me.thanks alot +0

Recommended Answers

All 2 Replies

Hi,
Use the following code i am sure it will help you

private static Control FindControlRecursive(Control Root, string Id)
{
if (Root.ID == Id)
  return Root;

foreach (Control Ctl in Root.Controls)
{
Control FoundCtl = FindControlRecursive(Ctl, Id);
if (FoundCtl != null)
  return FoundCtl;
}
return null;
}
commented: this solution work for me.thanks alot +0

Hi,
Use the following code i am sure it will help you

private static Control FindControlRecursive(Control Root, string Id)

{

if (Root.ID == Id)

return Root;

foreach (Control Ctl in Root.Controls)

{

Control FoundCtl = FindControlRecursive(Ctl, Id);

if (FoundCtl != null)

return FoundCtl;

}

return null;

}

in VB.Net please :$

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.