473,395 Members | 1,905 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

recursive help please

hey all,
i have to 2 tables (Tbl1 and Tbl2) that's contained in a fieldset, which is
contained in a tablecell of a table, which is contained in a div, which is
contained in a panel (still with me?)

can someone please show me how to recursively get to both tables that
contains "Tbl" in the IDs?

thanks,
rodchar
Dec 5 '07 #1
2 922
trival:

// find all controls on page that start with "Tbl"

Control[] list = ControlWalker(this, delegate(Control ctl)
{
return ctl.ID != null && ctl.ID.StartsWith("Tbl");
});

......

public delegate bool ControlWalkerMatcher (Control ctl);
public Control[] ControlWalker(Control ctl, ControlWalkerMatcher matcher)
{
ArrayList list = new ArrayList();
if (matcher(ctl)) list.Add(ctl);
for (int i=0; i < ctl.Controls.Count; ++i)
{
Control[] childList = ControlWalker(ctl.Controls[i],matcher);
if (childList.Length 0) list.AddRange(childList);
}
return (Control[]) list.ToArray(typeof(Control));
}
-- bruce (sqlwork.com)
"rodchar" wrote:
hey all,
i have to 2 tables (Tbl1 and Tbl2) that's contained in a fieldset, which is
contained in a tablecell of a table, which is contained in a div, which is
contained in a panel (still with me?)

can someone please show me how to recursively get to both tables that
contains "Tbl" in the IDs?

thanks,
rodchar
Dec 5 '07 #2
thanks bruce for the help.
rod.

"bruce barker" wrote:
trival:

// find all controls on page that start with "Tbl"

Control[] list = ControlWalker(this, delegate(Control ctl)
{
return ctl.ID != null && ctl.ID.StartsWith("Tbl");
});

......

public delegate bool ControlWalkerMatcher (Control ctl);
public Control[] ControlWalker(Control ctl, ControlWalkerMatcher matcher)
{
ArrayList list = new ArrayList();
if (matcher(ctl)) list.Add(ctl);
for (int i=0; i < ctl.Controls.Count; ++i)
{
Control[] childList = ControlWalker(ctl.Controls[i],matcher);
if (childList.Length 0) list.AddRange(childList);
}
return (Control[]) list.ToArray(typeof(Control));
}
-- bruce (sqlwork.com)
"rodchar" wrote:
hey all,
i have to 2 tables (Tbl1 and Tbl2) that's contained in a fieldset, which is
contained in a tablecell of a table, which is contained in a div, which is
contained in a panel (still with me?)

can someone please show me how to recursively get to both tables that
contains "Tbl" in the IDs?

thanks,
rodchar
Dec 5 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Oxmard | last post by:
Armed with my new O'Reilly book Optimizing Oracle Performance I have been trying to get a better understanding of how Oracle works. The book makes the statement, " A database cal with dep=n + 1...
1
by: Jon Slaughter | last post by:
I've managed to put together a template class that basicaly creates a recursive tree that lets you easily specify the "base" class of that tree and and ending notes and lets you stop the recursive...
5
by: purushneel | last post by:
Hi, I work primarily on Oracle databases. I am trying to convert a recursive stored procedure written in Oracle to DB2. Does DB2 UDB v8.2 (Windows/AIX) supports recursive stored procedures ??...
4
by: hapa | last post by:
i was looking for questions on while loops when i came across a problem that said write a program that displays fibonacci numbers and the code that i wrote works just fine int x1=1; int...
41
by: Harry | last post by:
Hi all, 1)I need your help to solve a problem. I have a function whose prototype is int reclen(char *) This function has to find the length of the string passed to it.But the conditions...
18
by: Just Another Victim of the Ambient Morality | last post by:
Is pyparsing really a recursive descent parser? I ask this because there are grammars it can't parse that my recursive descent parser would parse, should I have written one. For instance: ...
1
by: rekkufa | last post by:
I am currently building a system for serializing python objects to a readable file-format, as well as creating python objects by parsing the same format. It is more or less complete except for a...
4
by: ThEoNeAnDOnLy | last post by:
I recently had an issue with my recursive project in class. Here is the code. // Recursion.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include...
10
by: =?UTF-8?B?RXJpayBXaWtzdHLDtm0=?= | last post by:
On 2008-09-09 17:53, contactmayankjain@gmail.com wrote: And why did you pick this group, out of all possible groups, to ask this question? After all, it does not have anything to do with C++, nor...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.