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?
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 = newpagePicker(null);
///
<summary>
/// Holds a reference to the PagePicker
///</summary>
privatepagePicker 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>
protectedoverridevoid OnInit(EventArgs e)
{
base.OnInit(e);
PagePicker.ID =
"ContentPicker";
PagePickerHolder.Controls.Add(PagePicker);
}
You can get/set the value by referencing the Value property
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?
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?
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
Then in my onInit event I'll add it to an existing placeholder.
You can get/set the value by referencing the Value property
Cheers,
Richard
Fantastic Richard! I've almost got it working, will update when it's working!
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?
Sorry, I never finished this, went with another approach later on. But check out the code above and give it a go. :-)
is working on a reply...