Exemplo n.º 1
0
 private void SetContainedControlsParent(Interop.IHTMLElement element)
 {
     Interop.IHTMLElementCollection elementChildren = (Interop.IHTMLElementCollection)element.GetChildren();
     if (elementChildren != null)
     {
         int i = elementChildren.GetLength();
         for (int j = 0; j < i; j++)
         {
             Interop.IHTMLElement childElement = (Interop.IHTMLElement)elementChildren.Item(j, j);
             if (childElement != null)
             {
                 object[] locals = new object[1];
                 childElement.GetAttribute("id", 0, locals);
                 string str2 = locals[0] as String;
                 System.Web.UI.Control control = _designerHost.Container.Components[str2] as System.Web.UI.Control;
                 if (control != null && control.Parent != _control)
                 {
                     _control.Controls.Add(control);
                     ControlDesigner controlDesigner = _designerHost.GetDesigner(control) as ControlDesigner;
                     if (controlDesigner != null)
                     {
                         controlDesigner.OnSetParent();
                     }
                 }
                 else
                 {
                     SetContainedControlsParent(childElement);
                 }
             }
         }
     }
 }