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
}
}
}
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 ?
Thanks,
Gavin
Comment author was deleted
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
Trick is to wrap the umbraco control in a webcontrol
http://contourstrikesagain.codeplex.com/SourceControl/latest#ContourStrikesAgain/Controls/MediaPicker.cs
Thanks Tim!
is working on a reply...