Exemple #1
0
        private void AddWebPartToList(WebPartCollection webParts, Control control)
        {
            WebPart part = control as WebPart;

            // We used to throw an exception if the template contained a non-whitespace literal.
            // However, sometimes Venus would insert <br /> tags between the server controls
            // in the template.  So, we now just ignore all literals.
            if ((part == null) && !(control is LiteralControl))
            {
                WebPartManager manager = WebPartManager;
                if (manager != null)
                {
                    part = manager.CreateWebPart(control);
                }
                else
                {
                    part = WebPartManager.CreateWebPartStatic(control);
                }
            }

            if (part != null)
            {
                webParts.Add(part);
            }
        }
        private void AddWebPartToList(WebPartCollection webParts, Control control) {
            WebPart part = control as WebPart;

            // We used to throw an exception if the template contained a non-whitespace literal.
            // However, sometimes Venus would insert <br /> tags between the server controls
            // in the template.  So, we now just ignore all literals.
            if ((part == null) && !(control is LiteralControl)) {
                WebPartManager manager = WebPartManager;
                if (manager != null) {
                    part = manager.CreateWebPart(control);
                }
                else {
                    part = WebPartManager.CreateWebPartStatic(control);
                }
            }

            if (part != null) {
                webParts.Add(part);
            }
        }
 private void AddWebPartToList(WebPartCollection webParts, Control control)
 {
     WebPart part = control as WebPart;
     if ((part == null) && !(control is LiteralControl))
     {
         WebPartManager webPartManager = base.WebPartManager;
         if (webPartManager != null)
         {
             part = webPartManager.CreateWebPart(control);
         }
         else
         {
             part = WebPartManager.CreateWebPartStatic(control);
         }
     }
     if (part != null)
     {
         webParts.Add(part);
     }
 }
Exemple #4
0
        private void AddWebPartToList(WebPartCollection webParts, Control control)
        {
            WebPart part = control as WebPart;

            if ((part == null) && !(control is LiteralControl))
            {
                WebPartManager webPartManager = base.WebPartManager;
                if (webPartManager != null)
                {
                    part = webPartManager.CreateWebPart(control);
                }
                else
                {
                    part = WebPartManager.CreateWebPartStatic(control);
                }
            }
            if (part != null)
            {
                webParts.Add(part);
            }
        }
 internal WebPartCollection GetWebPartsForZone(WebPartZoneBase zone)
 {
     if (zone == null)
     {
         throw new ArgumentNullException("zone");
     }
     if (!this._webPartZones.Contains(zone))
     {
         throw new ArgumentException(System.Web.SR.GetString("WebPartManager_MustRegister"), "zone");
     }
     IList allWebPartsForZone = this.GetAllWebPartsForZone(zone);
     WebPartCollection parts = new WebPartCollection();
     if (allWebPartsForZone.Count > 0)
     {
         foreach (WebPart part in allWebPartsForZone)
         {
             if (this.ShouldRenderWebPartInZone(part, zone))
             {
                 parts.Add(part);
             }
         }
     }
     return parts;
 }