Copied to clipboard

Flag this post as spam?

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


  • Jamie Wu 19 posts 79 karma points
    Sep 13, 2011 @ 17:30
    Jamie Wu
    0

    Ultimate Picker and macro parameters

    Hi there,

    I am using a Ultimate Picker (Berto) to get a list of one node's children. It is a multisite installation. The nodes structure is showing below:

    - Content
    - - Template A
    - - - V1
    - - - - Site 1
    - - - - - Container
    - - - - - - Item 1
    - - - - - - Item 2
    - - - - Site 2

    As illustrated, The Template is a folder, then V1 is a sub-folder, Site 1 and Site 2 are under V1.

    The Ultimate Picker is a property of Site 1 and is able to get the list of 'Container' children as checkboxes. I am also using a Macro with a parameter from alias [#ultimatepicker] to get the nodeIDs of Item 1 and Item 2. However for some reasons, the macro parameter is unable to get actual IDs of Item 1 and Item 2. 

    I am wondering if the [#] or [$] works like its going through the node from root of 1st level (Template A) rather the Current one (Site 1, Site 2). 

    Hope I am expressing myself well. 

    Thanks

    Jamie

  • Tom Hare 49 posts 81 karma points
    Sep 13, 2011 @ 17:38
    Tom Hare
    0

    Hi Jamie,

    Are you using XSLT for this? Could you post the code so we can see?

    Tom

  • Jamie Wu 19 posts 79 karma points
    Sep 13, 2011 @ 17:51
    Jamie Wu
    0

    Thanks for the very quick reply Tom.

    I am not using XSLT on this solution. All is umbraco itself and .Net. In the Ultimate Picker (Berto) I set the 'Parent Filter' as the alias of the 'Container'. The macro is actually a user control. The macro itself is <umbraco:Macro Widgets="[#ultimatePicker]" Alias="SidebarWidgets" runat="server"></umbraco:Macro>

    There is bit of code of user control

     

     

    using System.Diagnostics;

    using umbraco.presentation.nodeFactory;

    using umbraco.presentation.templateControls;

    using uComponents.Core;

    using uComponents.Core.uQueryExtensions;

    using umbraco.BusinessLogic.Actions;

     

    namespace SidebarWidgets

    {

        public partial class SidebarWidgets : System.Web.UI.UserControl

        {

            private string widgets;

            

            public string Widgets

            {

                get { return widgets; }

                set { widgets = value; }

            }

     

            protected void Page_Load(object sender, EventArgs e)

            {

                this.widgetRepeater.DataSource = uQuery.GetNodesByCsv(this.widgets); 

                this.widgetRepeater.DataBind();

            }

     

            /// <summary>

            /// for each widget set and add an Item control

            /// </summary>

            protected void WidgetRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)

            {

                if (e.Item.ItemType == ListItemType.Item ||

                    e.Item.ItemType == ListItemType.AlternatingItem)

                {

                    Node widgetNode = (Node)e.Item.DataItem;

                    PlaceHolder contentPlaceHolder = (PlaceHolder)e.Item.FindControl("ContentPlaceHolder");

                    

                    Item item = new Item();

                    item.NodeId = widgetNode.Id.ToString();

                    item.Field = "content";

     

                    contentPlaceHolder.Controls.Add(item);

                }

            }

        }

    }

     

Please Sign in or register to post replies

Write your reply to:

Draft