Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

recursive help please

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rodchar - 05 Dec 2007 02:22 GMT
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
bruce barker - 05 Dec 2007 17:39 GMT
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)

> hey all,
> i have to 2 tables (Tbl1 and Tbl2) that's contained in a fieldset, which is
[quoted text clipped - 6 lines]
> thanks,
> rodchar
rodchar - 05 Dec 2007 18:33 GMT
thanks bruce for the help.
rod.

> trival:
>    
[quoted text clipped - 32 lines]
> > thanks,
> > rodchar

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.