More in this section

Forums / Developing with Sitefinity / How to get a rendered page?

How to get a rendered page?

2 posts, 0 answered
  1. Khai
    Khai avatar
    7 posts
    14 Nov 2011
    18 Nov 2011
    Link to this post
    Hello there,

    I'm trying to get the rendered html of a page, I've tried the InMemoryPageRender but the problem with that is that it isn't able to show dynamic data. Is there a way to get a full rendered html of a page? 

    ( I'm trying to use jQuery.Load() with sitefinity and I need the html of a page )
  2. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    03 Nov 2014
    23 Nov 2011
    Link to this post
    Hi Khai,

    Please take a look at this KB article:

    It outlines how you can override the page route handler. You can get an instance of the rendered Page at some late stage - for example in the

    public override void ProcessRequiredControls(Page page, PageSiteNode data)

    method, or in the

    protected override IHttpHandler BuildHttpHandler(RequestContext requestContext)

    get a reference to the page like this

    var handler = (Page)BuildManager.CreateInstanceFromVirtualPath(virtualPath, typeof(Page));

    and subscribe to its PreRenderComplete event like this

    handler.PreRenderComplete += new EventHandler(handler_PreRenderComplete);

    and there you can cast the sender to Page and could use the InMemoryPageRender to get the page rendered.

    All the best,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered