Trying to convert to vb. Got this far but don't know what to do with c >=
c.ID = "Table2.
If you know both vb and c# I could use another push
Dim list As Generic.List(Of Control) = FindControls(Page, c >= c.ID =
"Table2")
....
Public Shared Function FindControls(ByVal parent As Control, ByVal match As
Predicate(Of Control)) As Generic.List(Of Control)
Dim list As Generic.List(Of Control) = New Generic.List(Of Control)()
For Each ctl As Control In parent.Controls
If match(ctl) Then
list.Add(ctl)
End If
list.AddRange(FindControls(ctl, match)) 'Adds the elements of the collection
ctl to the end
Next
Return list
End Function
Thanks
"bruce barker" <br*********@discussions.microsoft.comwrote in message
news:75**********************************@microsof t.com...
just a couple lines of code:
public static List<ControlFindControls(Control parent,
Predicate<Controlmatch)
{
var list = new List<Control>();
foreach (Control ctl in parent.Controls)
{
if (match(ctl))
list.Add(ctl);
list.AddRange(FindControls(ctl, match));
}
return list;
}
to use:
var list = FindControls(Page, c =c.ID == "myid");
-- bruce (sqlwork.com)
"AAaron123" wrote:
>I'm this far in determining the correct code to find a textbox I need to
set.
Me.Master.FindControl("Body1").FindControl("Form2 ").FindControl("Table2").FindControl("TableRow7"). FindControl("TableCellR7C2S2").FindControl("RightC PH").FindControl("div1").FindControl("div2").FindC ontrol("LoginView1")
Took me longer than I want to say to produce the above and I'm not there
yet.
Isn't there a better way? Seems a routine that recursively searches might
work.
So my question is: Is there a better way or do I have to keep working to
finish the above.
Thanks
PS Then if a year form now someone changes almost anything in the .aspx
file
this will break!