Copied to clipboard

Flag this post as spam?

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


  • Eric 35 posts 55 karma points
    Sep 12, 2011 @ 15:20
    Eric
    0

    reuse Umbraco datatypes in a Custom datatype

    Hi there,

    I am using Umbraco 4.7 and should develop a custom datatype that groups some Umbraco Datatypes.

    Basicaly it is about to create a custom web control (as a class, not ascx file) that allow you among other things to upload a jpg/png to the server and to pick a page in the content tree. In order to achieve this goal, since Umbraco datatypes already exist (Upload + Content Picker) I would like to reuse them without to worry about how they are implemented

    The Upload and ContentPicker datatypes should just work in my custom control as they usually do.

    Here is the code (part of it - since it produces errors and I have not been able to answer some questions).

            protected PlaceHolder _ph = new PlaceHolder();
            private pagePicker _pick = new pagePicker();
            private uploadField _banner = new uploadField();
    //uploadField takes 2 arguments (umbraco.Interfaces.IData + string)
    //can not figure out if there is a way to instantiate without
    //implement a new IData since I just want it to behave
    //like the standard back-end uploadField...
            protected override void OnLoad(EventArgs e)
            {
                //base.OnLoad(e);
                EnsureChildControls();
                EnsureID();
            }
            protected override void OnInit(EventArgs e)
            {
                base.OnInit(e);
                Controls.Add(_ph);
                _ph.Controls.Add(_pick);
    _ph.Controls.Add(_banner);         }

    Anyway, this code is not working and just produce an error (even is everything that is related to uploadField is commented out). Any idea of how to simply reuse the Umbraco datatypes ?

    Thaks in advance,

    EL

Please Sign in or register to post replies

Write your reply to:

Draft