[CLOSED] best way to traverse the server controls hierarchy of a page

  1. #1

    [CLOSED] best way to traverse the server controls hierarchy of a page

    Hi:

    I need to traverse the server ext.net controls hierarchy that have been added to a page. I just want to make sure I am scanning all controls.

    Would this do it:

        private void DisplayUIControls(IndentedTextWriter writer, Control control)
        {
          Component xnetComponent = control as Component;
          if (xnetComponent != null && !String.IsNullOrEmpty(xnetComponent.ItemID))
          {
            writer.WriteLine("// {0}", xnetComponent.ItemID);
          }
    
          foreach (Control child in control.Controls)
          {        
            writer.Indent += 1;
            DisplayUIControls(writer, child);
            writer.Indent -= 1;
          }
        }
    The reason I am asking is because for certain controls, let's say panels, they have multiple inner containers: Items, Buttons, TopBar, BottomBar. I want to make sure I am covering all these containers in one shot.

    Thank you
    Last edited by geoffrey.mcgill; Aug 31, 2011 at 4:02 AM. Reason: [CLOSED]
  2. #2
    Hi,

    There are some "FindControl" helpers in the Utilities library that might be helpful, see

    Ext.Net.Utilities.ControlUtils
    Geoffrey McGill
    Founder
  3. #3
    Thank you. Yes, they are useful, this is what I based my code on :-). I would have used them but I need to know the path as I traverse the hierarchy.
  4. #4
    Traversing Ext.Net widgets is the same like for classic ASP.NET controls. All widgets from Items, Buttons and etc collections are added to Controls collection. So, just traverse Controls collection

Similar Threads

  1. [CLOSED] Selection popup for a very large number of hierarchy items
    By deejayns in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 14, 2011, 3:38 PM
  2. Replies: 2
    Last Post: Feb 16, 2011, 9:10 AM
  3. Replies: 0
    Last Post: Jan 05, 2011, 6:48 AM
  4. [CLOSED] Dynamically changing control hierarchy
    By randy85253 in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Dec 13, 2009, 4:57 PM
  5. Replies: 0
    Last Post: Mar 28, 2009, 3:30 AM

Posting Permissions