954,560 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Find control inside AJAX.Net UpdatePanel

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

Kusno
Junior Poster
191 posts since Aug 2007
Reputation Points: 11
Solved Threads: 17
 

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;
}
Sals
Light Poster
33 posts since Jan 2009
Reputation Points: 10
Solved Threads: 6
 

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 :$

Kusno
Junior Poster
191 posts since Aug 2007
Reputation Points: 11
Solved Threads: 17
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You