1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Rendered Page programmatically

Rendered Page programmatically

6 posts, 0 answered
  1. Dave
    Dave avatar
    37 posts
    Registered:
    26 Dec 2008
    03 Aug 2011
    Link to this post
    Hi there!

    I think there must be simple way to do this, but I didn't find it, somehow.

    For a special Navigation-Solution I do need the rendered content from a particular page in Sitefinity. I searched it in PageData, but couldn't find the desired method.

    Does anyone know a way to to this?

    Thanks in advance, Dieter

  2. Teodor
    Teodor avatar
    52 posts
    Registered:
    24 Sep 2012
    04 Aug 2011
    Link to this post
    Hi Dieter,
       
         You can see the class : InMemoryPageRender.   There are some limitations. First it will not render some of the controls that have a dynamic content like - NewsList , NewsDetailView and so on. Could you be more specific about what exactly you want to achieve.

    Regards,
    Teodor
    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
  3. Dave
    Dave avatar
    37 posts
    Registered:
    26 Dec 2008
    05 Aug 2011
    Link to this post
    Hi Teodor!

    Well, I'm trying to realize a navigation similar to the navigation on this site. The special sub-navigation under Products, Solutions, Purchase and so on.

    To give the Backend-User the posibility to design the sub-navigation I have created a page under the specific Menu-Item. Now I want to load this page (only the content between the form-tags) to display it as sub-navigation.

    I've tried to use this lines of code

    var navContent = item.FindControl("NavContent") as Literal;
     
    var mywebReq = WebRequest.Create("puturlhere");
    var mywebResp = mywebReq.GetResponse();
    var sr = new StreamReader(mywebResp.GetResponseStream());
    var strHTML = sr.ReadToEnd();
     
    string[] lines = Regex.Split(strHTML, "<!--Content-->");
     
    navContent.Text = lines[1];
     
    but since the Links of inserted Navigation-Controls are rendered relative, the links doesn't work. Is there a way to let the navigation links rendered abolute?

    Or is there a better way to accomplish this goal?

    Thank You for Your help!

    Dieter
  4. Teodor
    Teodor avatar
    52 posts
    Registered:
    24 Sep 2012
    10 Aug 2011
    Link to this post
    Hi Dieter,
     
    I am still not sure what exactly you want to do.  When you render the page you get the content of the page. If you want to make the urls from relative to absolute one way is to parse the html and get the urls and try to resolve them as relative.Another way is to make a page that uses some custom navigation control and renders the urls as absolute.
    If this does not help could you try to provide more information about the goal you want to achieve and we will think for a better way to achieve it. Can you explain what is the purpose of this navigation and its requirements?

    Best wishes,
    Teodor
    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
  5. readonlychild
    readonlychild avatar
    67 posts
    Registered:
    26 May 2011
    12 Aug 2011
    Link to this post
    Hello Dieter,

    Maybe your user could create a content block with the markup that should display when clicking/hovering on the first navigation-item, and name the content block "menu-item-1-markup"

    Then you could check if a content block named "menu-item-X-markup" exists and display that in your literal...

    Just a different approach to your scenario... HTH


    string cname = "menu-item-" + index +  "-markup";

     var genericContent = App.WorkWith()
         .ContentItems()
         .Where(c => c.Status == Telerik.Sitefinity .GenericContent.Model.ContentLifecycleStatus.Live)
         .Where(c => c.Title == cname)
         .Get();

    foreach (var item in genericContent) { 
        this.Literal.Text = item.Content;
    }
  6. Dave
    Dave avatar
    37 posts
    Registered:
    26 Dec 2008
    22 Aug 2011
    Link to this post
    Hi there!

    Thank You readonlychild and Teodor for Your help.

    My goal is to get a similar Navigation like on this side (telerik) that is displayed, when I click on the specific Menu-Item. The Sub-Navigation under Products, Solutions, Purchase and so on, should be manageable by the Backend-Users.

    I wanted to get shure, that the User is able to use most of the Controls that are available for Pages to manage the Content from the Sub-Navigation.

    So I've now used the code in my previous post and programmed a special Navigation-Control.

    The disadvantage from this solution is, that the Sub-Navigation of each first-level-item is a page in Sitefinity and I have to render them completely and strip away the surroundings (head-tag, form-tag and so on) later.

    But for now I don't know another solution.

    Dieter
6 posts, 0 answered