Пример #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);
            }
        }
Пример #2
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);
            }
        }
Пример #3
0
        private void AddControlToDescriptions(Control control, ArrayList descriptions)
        {
            WebPart webPart = control as WebPart;

            if ((webPart == null) && !(control is LiteralControl))
            {
                // Fix for DesignMode
                if (WebPartManager != null)
                {
                    webPart = WebPartManager.CreateWebPart(control);
                }
                else
                {
                    webPart = WebPartManager.CreateWebPartStatic(control);
                }
            }

            // Fix for DesignMode
            if (webPart != null && (WebPartManager == null || WebPartManager.IsAuthorized(webPart)))
            {
                WebPartDescription description = new WebPartDescription(webPart);
                descriptions.Add(description);
            }
        }