Copied to clipboard

Flag this post as spam?

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


  • Gavin Lyons 13 posts 71 karma points
    Aug 20, 2013 @ 10:25
    Gavin Lyons
    0

    FieldSettings MediaPicker

    Hi,

    I got the Content Picker working as a Fieldsetting in the form setup of Contour. However I like to choose media item via a media picker in the form setup.

    How do I return the Umbraco Control in the RenderControl function ?

    using System.Web;
    using System.Web.UI.WebControls;
    using Umbraco.Forms.Core.Attributes;
    using Umbraco.Forms.Core;
    using umbraco.cms.businesslogic.datatype;
    using umbraco.controls;
    
    namespace Application.Web.ContourExtended.FieldSettings
    {
        public class MediaPicker : Umbraco.Forms.Core.FieldSetting.Pickers.BasePicker
        {
                    public MediaPicker()
            {
                ObjectGuid = new Guid("a2cb7830-f571-4787-9638-bc4111ba9efb");
            }
    
            public Guid ObjectGuid { get; set; }
            public override string Value { get; set; }
    
            public override WebControl RenderControl(Setting sender, Form form)
            {
    
               return base.RenderControl(sender, form);
    
                // DataTypeDefinition dataTypeDefinition1 = DataTypeDefinition.GetDataTypeDefinition(1034);
                // ContentPicker mp = (umbraco.controls.ContentPicker)dataTypeDefinition1.DataType.DataEditor;
    
                ContentPicker mp = new ContentPicker();
                mp.AppAlias = "media";
                mp.TreeAlias = "media";
    
                return mp; /// --- Unable return an Umbraco Control as webcontrol 
            }        
        }
    
    
    }

     

    Thanks,

    Gavin

  • Comment author was deleted

    Aug 20, 2013 @ 10:45

    Hi Gavin

    Check out this one http://contourstrikesagain.codeplex.com/SourceControl/latest#ContourStrikesAgain/Providers/FieldSettingTypes/MediaPicker.cs (some controls I made a while ago and it also includes a media picker field setting type)

  • Comment author was deleted

    Aug 20, 2013 @ 10:56
  • Gavin Lyons 13 posts 71 karma points
    Aug 20, 2013 @ 17:18
    Gavin Lyons
    0

    Thanks Tim! 

Please Sign in or register to post replies

Write your reply to:

Draft