Render() public method

public Render ( ) : System.Web.HtmlString
return System.Web.HtmlString
Esempio n. 1
0
        /// <summary>
        /// Process View if a Template has been set
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_PreRender(object sender, EventArgs e)
        {
            try
            {
                // check things if it's a module of this portal (ensure everything is ok, etc.)
                var isSharedModule = ModuleConfiguration.PortalID != ModuleConfiguration.OwnerPortalID;
                if (!isSharedModule && !SxcI.ContentBlock.ContentGroupExists && SxcI.App != null)
                {
                    new DnnStuffToRefactor().EnsurePortalIsConfigured(SxcI, Server, ControlPath);
                }

                var renderNaked = (Request.QueryString["standalone"] == "true");
                if (renderNaked)
                {
                    SxcI.RenderWithDiv = false;
                }
                var renderedTemplate = SxcI.Render().ToString();

                // If standalone is specified, output just the template without anything else
                if (renderNaked)
                {
                    SendStandalone(renderedTemplate);
                }
                else
                {
                    phOutput.Controls.Add(new LiteralControl(renderedTemplate));
                }
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Esempio n. 2
0
        /// <summary>s
        /// Process View if a Template has been set
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_PreRender(object sender, EventArgs e)
        {
            try
            {
                // check things if it's a module of this portal (ensure everything is ok, etc.)
                var isSharedModule = ModuleConfiguration.PortalID != ModuleConfiguration.OwnerPortalID;
                if (!isSharedModule && !SxcInstance.ContentBlock.ContentGroupExists && SxcInstance.App != null)
                {
                    new DnnStuffToRefactor().EnsureTenantIsConfigured(SxcInstance, Server, ControlPath);
                }

                var renderNaked = Request.QueryString["standalone"] == "true";
                if (renderNaked)
                {
                    SxcInstance.RenderWithDiv = false;
                }
                var renderedTemplate = SxcInstance.Render().ToString();

                // call this after rendering templates, because the template may change what resources are registered
                RegisterResources();

                // optional detailed logging
                try
                {
                    if (Request.QueryString["debug"] == "true")
                    {
                        // only attach debug, if it has been enabled for the current time period
                        if (UserInfo.IsSuperUser || Logging.EnableLogging(GlobalConfiguration.Configuration
                                                                          .Properties))
                        {
                            renderedTemplate += HtmlLog();
                        }
                    }
                }
                catch { /* ignore */ }

                // If standalone is specified, output just the template without anything else
                if (renderNaked)
                {
                    SendStandalone(renderedTemplate);
                }
                else
                {
                    phOutput.Controls.Add(new LiteralControl(renderedTemplate));
                }
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }