Copied to clipboard

Flag this post as spam?

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


  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Feb 02, 2010 @ 10:33
    Tim
    0

    Add Content Picker to DataType Settings

    I'm attempting to write my first custom datatype, and one of the things I would like to do as part of the settings is have a content picker that allows me to pick the starting node of the DataType. I've worked out how to add standard form fields to the settings section, how would I go about adding an Umbraco control as a setting option? Does anyone have an example of doing this?

    :)

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Feb 02, 2010 @ 11:20
    Dirk De Grave
    0

    Here's what I did for a similar project:

    Add a placeholder control on your user control (eg. phContentPicker) in design view

    Add this snippet to your code behind class:

    protected ContentPicker _nodePicker = new ContentPicker() {ID = "_nodePicker", AppAlias = "content"};

    on page load or page init, use:

    phNodeSelector.Controls.Add(_nodePicker);

    to add the content picker control to the placeholder.

    you can get the selected node via the .Text property.

     

    Hope this helps.

    Regards,

    /Dirk

     

     

     

     

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Feb 02, 2010 @ 11:27
    Tim
    0

    Thanks Dirk that's exactly what I was looking for, I thought it would be something like that, but I wasn't 100% sure, I'm still finding my way round the Umbraco controls and API!

    :)

Please Sign in or register to post replies

Write your reply to:

Draft