Search code examples
c#.netumbracoumbraco6

Custom DataType for Umbraco containing MultiUrlPicker


I am trying to create a custom DataType for Umbraco containing group of elements which include a TextBox, MediaPicker and a MultiUrlPicker. I can create a Text Box using the following snippet:

var textBox = new TextBox();

and a Media Picker using the following snippet:

var mediaPicker = new SimpleMediaPicker();

The above two work fine but struggling with how to add MultiUrlPicker in my custom control. I am trying to use the uComponnents package of Umbraco and it provides MultiUrlPickerDataType and MultiUrlPickerDataEditor classes but I am struggling to how to initiate and insert these into my control.


Solution

  • I made it work finally using the following code:

    var urlPicker = new MultiUrlPickerDataEditor {Settings = new MultiUrlPickerSettings{ Standalone = false }};
    

    Posting it here, in case anyone else ever struggle with the same thing.