1

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

Votes + Comments
this solution work for me.thanks alot
2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by Kusno
1

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;
}

Edited by __avd: Add [code] tags. Encase your code in: [code] and [/code] tags.

Votes + Comments
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 :$

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.