Copied to clipboard

Flag this post as spam?

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


  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Dec 10, 2009 @ 18:29
    Sebastiaan Janssen
    0

    Can I use an Umbraco datatype in a custom user control?

    I'm planning to write a user control and it would be very convenient if I could use the ultimate picker data type in there. Is this at all possible? Does someone have some example code available?

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Dec 10, 2009 @ 21:00
    Richard Soeteman
    1

    Hi Sebastiaan,

    In umbImport I'm using the Pagepicker, thin it's the same for the ultimate picker. First I initialize the PagePicker,'I'll pass the null value because I don't need to store the value in Umbraco. And I'll have a property because I never talk directly to private fields

    private

     

    pagePicker _pagePicker = new pagePicker(null);

     

    ///

     

    <summary>

     

    /// Holds a reference to the PagePicker

     

    /// </summary>

     

    private pagePicker PagePicker

    {

     

    get { return _pagePicker; }

    }

    Then in my onInit event I'll add it to an existing placeholder.

     

    /// <summary>

     

    /// Initialize the PagePicker Control

     

    /// </summary>

     

    /// <param name="e"></param>

     

    protected override void OnInit(EventArgs e)

    {

     

    base.OnInit(e);

    PagePicker.ID =

    "ContentPicker";

    PagePickerHolder.Controls.Add(PagePicker);

    }

    You can get/set the value by referencing the Value property

    Cheers,

    Richard

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Dec 11, 2009 @ 17:25
    Sebastiaan Janssen
    0

    Fantastic Richard! I've almost got it working, will update when it's working!

     

  • Ernst Utvik 123 posts 235 karma points
    Oct 29, 2010 @ 20:00
    Ernst Utvik
    0

    Did you ever get it working? I'm interested in seeing some more code examples on this. How do you call the pagepicker in your ascx? Would this work for the member picker datatype?

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Oct 30, 2010 @ 11:45
    Sebastiaan Janssen
    0

    Sorry, I never finished this, went with another approach later on. But check out the code above and give it a go. :-)

Please Sign in or register to post replies

Write your reply to:

Draft