Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Craig Cronin 304 posts 503 karma points
    Apr 03, 2013 @ 12:41
    Craig Cronin
    0

    Using a settings page as the source for RenderTemplate

    I'm using the render template macro on a content page which is working great, but would also like to set the page source to another node.

    This will allow me to have a global area to power my widgets but i can also add additional on the page.

     

    NodeIds="[#leftContentWidgets],[#defaultWidgets],1111" this only looks a the leftContentWidgets or defaultWidgets fields on the current page,

     

    I need a way of saying #leftContentWidgets is on node number X

    Thanks

     

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Apr 03, 2013 @ 13:16
    Lee Kelleher
    0

    Hi Craig,

    There isn't a way to specify the node to take the property values from - that's generally a wider Umbraco issue.

    For RenderTemplate, the way I would approach it is to do this programatically, see this code snippet:

    protected void Page_Load(object sender, EventArgs e)
    {
        // get the property value from the specific node
        var settingsNode = uQuery.GetNode(1234);
        var nodeIds = settingsNode.GetProperty<string>("leftContentWidgets ");
    
        // manually create the RenderTemplate control
        var ctrl = new uComponents.Controls.RenderTemplate() { NodeIds = nodeIds };
    
        // add the control to a placeholder (or wherever)
        this.Page.Controls.Add(ctrl);
    }

     

    Hope that makes sense?

    Cheers, Lee.

  • Craig Cronin 304 posts 503 karma points
    Apr 03, 2013 @ 23:36
    Craig Cronin
    0

    Hi Lee,

    I implemented this in my own server control today and it worked perfectly.  My control takes a CurrentPage parameter which allows me to set the location of the node ids.  This would be really good to include in uComponents in the future.  RenderTemplate is a really control is excellent!!!


    Thanks

    Craig

Please Sign in or register to post replies

Write your reply to:

Draft