Using the Umbraco Content picker as a media picker (or other tree picker)

Ever wanted to add a content picker or media picker to your custom controls?

Well in case of a content picker you can simply use the umbraco.controls.ContentPicker control

A nice thing about this control is that you can also feed it a different app and tree alias, turning it into a different kind of picker.

To use it as a media picker:

umbraco.controls.ContentPicker mp = new umbraco.controls.ContentPicker();
mp.AppAlias = "media";
mp.TreeAlias = "media";

4 Comments so far

  1. Jeroen Breuer on October 18th, 2010

    This works for content and media, but if you try it for members you get an error since the member tree wasn’t designed for this.

    It works as a media picker, but you can’t see a preview of the media item you’re selecting. That’s why I prefer to add the media picker datatype to a page (see


  2. Nauman on November 5th, 2010

    I have created object mm and
    mp.AppAlias = “media”;
    mp.TreeAlias = “media”;

    in my .cs code

    how to make it work on my .ascx page, so that media picker works on my control as it works within umbraco?

  3. Jacob on November 24th, 2010

    I have tried this, with the following:

    DataTypeDefinition dataTypeDefinition1 = DataTypeDefinition.GetDataTypeDefinition(1034);
    umbraco.controls.ContentPicker mediaPicker = (umbraco.controls.ContentPicker)dataTypeDefinition1.DataType.DataEditor;

    mediaPicker.AppAlias = “media”;
    mediaPicker.TreeAlias = “media”;


    Eventhough the id 1034 is the ContentPicker Datatype I still get the error:
    Unable to cast object of type ‘umbraco.editorControls.pagePicker’ to type ‘umbraco.controls.ContentPicker’

  4. Mike on May 5th, 2016

    Have you managed to get this working in a umbraco 7 site.. I’d like to use a aspx existing dashboard with content/media pickers.. but this no longer appears to work..

    errors with.
    [NullReferenceException: Object reference not set to an instance of an object.]
    umbraco.uicontrols.TreePicker.BaseTreePicker.RenderJSComponents() 33
    System.Web.UI.Control.PreRenderRecursiveInternal() 179

    I can’t see that this method does anymore than include some js files from embedded resources, but don’t have the nouse to investigate why it fails.

    any help really appreciated, other wise it’s rebuild time and teach myself angular :-(

Leave a Reply