/// <summary>
            /// Renders the content of one page within another page as items.
            /// </summary>
            /// <param name="page">Page instance</param>
            /// <param name="path">The path of the page to render.</param>
            /// <param name="data">(Optional) An array of data to pass to the page being rendered. In the rendered page, these parameters can be accessed by using the PageData property.</param>
            /// <returns></returns>
            public virtual TBuilder ItemsFromPage(System.Web.WebPages.WebPageBase page, string path, params object[] data)
            {
                BaseControl.SectionsStack.Push(new List <string>());
                var result = page.RenderPage(path, data);

                this.HandleResult(result);

                return(this as TBuilder);
            }
Пример #2
0
            /// <summary>
            /// Renders the content of one page within another page to content area of the widget
            /// </summary>
            /// <param name="page"></param>
            /// <param name="path"></param>
            /// <param name="data"></param>
            /// <returns></returns>
            public virtual TBuilder ContentFromPage(System.Web.WebPages.WebPageBase page, string path, params object[] data)
            {
                BaseControl.SectionsStack.Push(null);
                var result = page.RenderPage(path, data);

                if (result != null)
                {
                    this.ToComponent().ContentControls.Add(new LiteralControl(result.ToHtmlString()));
                }
                BaseControl.SectionsStack.Pop();
                return(this as TBuilder);
            }
Пример #3
0
            /// <summary>
            /// Renders the content of one page within another page as items.
            /// </summary>
            /// <param name="page">Page instance</param>
            /// <param name="path">The path of the page to render.</param>
            /// <param name="data">(Optional) An array of data to pass to the page being rendered. In the rendered page, these parameters can be accessed by using the PageData property.</param>
            /// <returns></returns>
            public virtual TBuilder ItemsFromPage(System.Web.WebPages.WebPageBase page, string path, params object[] data)
            {
                BaseControl.SectionsStack.Push(new List <string>());
                var result = page.RenderPage(path, data);

                if (result != null)
                {
                    this.ToComponent().ItemsToRender = result.ToHtmlString();
                    this.ToComponent().IDSToRender   = BaseControl.SectionsStack.Pop();
                }
                else
                {
                    BaseControl.SectionsStack.Pop();
                }

                return(this as TBuilder);
            }
Пример #4
0
        public static void InlineArticleImages(ref ArticleViewModel a, System.Web.WebPages.WebPageBase wpb)
        {
            string rxTagsPattern = @"\[IMAGE:(?<imageId>\d+)\]";
            Regex  rxTags        = new Regex(rxTagsPattern, RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.ExplicitCapture);

            foreach (Match m in rxTags.Matches(a.Body))
            {
                long   imgId   = -1;
                string imgHtml = "";
                if (long.TryParse(m.Groups["imageId"].Value, out imgId))
                {
                    var img = a.Images.Where(i => i.FileId == imgId).FirstOrDefault();
                    if (img != null)
                    {
                        imgHtml = wpb.RenderPage("_" + ViewType.inlineimage.ToString() + ".cshtml", img).ToHtmlString();
                    }
                }
                a.Body = Regex.Replace(a.Body, "\\[IMAGE:" + imgId.ToString() + "\\]", imgHtml);
            }
        }