Copied to clipboard

Flag this post as spam?

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


  • Sune Jepsen 25 posts 109 karma points
    Jan 10, 2011 @ 00:03
    Sune Jepsen
    0

    contentpicker in content section to pick from custom section

    Ive build a custom section where I have my products. My goal is I want to reach these product from my content pages. Therefore I created a custom datatype with a contentpicker. The contentpicker should be able to pick a product from my custom section. Here's my code from my customdatatype:

       public partial class ShopContentPicker : System.Web.UI.UserControl,
            umbraco.editorControls.userControlGrapper.IUsercontrolDataEditor
        {
            protected ContentPicker _nodePicker = new ContentPicker();
            protected void Page_Load(object sender, EventArgs e)
            {
                _nodePicker.AppAlias = "shop";
                _nodePicker.TreeAlias = "Products";
                plhControls.Controls.Add(_nodePicker);
               
            }

            #region IUsercontrolDataEditor Members

            public object value
            {
                get
                {
                    return _nodePicker.Value;
                }
                set
                {
                    if (value != null)
                    {
                            _nodePicker.Value = value.ToString();
                    }
                }
            }

            #endregion
        }

     Ive added my custom datatype to my documenttype. After that its visible on my contentpage (products). It launhces fine and the productstree is visible, but when I pick a node, its looking for corresponding edit page which it shows in the custom section. And off cource this results in an error. So in a way the tree is doing what ive coded earlier, but in this new  situation I want to pick the nodeid (product).  So how can I achieve this, Im looking for same functionality which the mediapicker offers, just on my custom section with the contentpicker.  

Please Sign in or register to post replies

Write your reply to:

Draft