Copied to clipboard

Flag this post as spam?

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


  • Sony 20 posts 40 karma points
    Dec 30, 2010 @ 13:38
    Sony
    0

    how to make Ultimate picker to show content of doctype in umbraco backend

    hello all,

                    Is it possible to define a ultimate picker datatype to show image with checkbox in the umbraco backend. now i can choose the datatype,parentnodeid, and document type and make a ultimate picker datatype.

              It displays checkbox with node name. i want to display picture with checkbox as the document type has the picture uploaded..  is there any way to accomplish this in umbraco..

     

    Thanks & Regards,

    Sony.

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Dec 30, 2010 @ 14:07
    Tom Fulton
    0

    Hi Sony,

    Not with the built in ultimate picker datatype.  But if you're comforatable writing .NET you can easily create your own datatype to achieve this.

    Another alternative, the uComponents package might have a few datatypes that would suit your needs, such as Radiobutton List with Images, ImageDropDown, or MultiNode Tree Picker in Media mode.  None are exactly what you are asking for but might work for what you need

    -Tom

     

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Dec 30, 2010 @ 14:09
    Tom Fulton
    0

    Actually I misread - the image you want to show is uploaded on the document itself?  In that case you will need to create your own datatype - these packages read images from the media section or prevalues.  If you need info on creating a datatype let us know...

  • Sony 20 posts 40 karma points
    Dec 30, 2010 @ 14:39
    Sony
    0

    Hello Tom, yes.. can you provide sample as how to achieve above functionality?

    thank you

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Dec 30, 2010 @ 15:23
    Tom Fulton
    0

    Hi Sony,

    There are two ways to go about it, using a usercontrol or creating a class that inherits from AbstractDataEditor.

    The usercontrol is a bit easier but does not allow you to store prevalues (settings).  Settings might be useful in your case depending on where you are reading the checkbox options from.  If it's from nodes under the current node for instance, you can easily list the children...but if it's from a completely unrelated node it would be beneficial to have a setting called "start node id" similar to Ultimate Picker.  Otherwise you'd have to hardcode the nodeID in the code.

    Here are some tutorials on each method, along with downloadable source code:

    Creating custom umbraco datatypes revisited   (AbstractDataEditor)
    Creating custom datatypes using the umbraco usercontrol wrapper

    There are also some on umbraco.tv (see a few under Data Editors):  http://umbraco.tv/help-and-support/video-tutorials/developing-with-umbraco

    In your control you would use the Document API to add the documents to a checkbox list or however you wanted to render them, something like:

    using umbraco.cms.businesslogic.web;
    Document d = new Document(startnodeid);    // or Request.QueryString["id"] for the current node
    foreach (Document childDoc in d.Children) {
        // add to a checkbox list or other control/literal
        // id of document: childDoc.Id;   name of document: childDoc.Text;
        // get properties, such as your image, like childDoc.getProperty("yourPropertyAlias").Value.ToString()
    }

    Not sure if you can use images with a CheckBoxList, you might have to do your own implementation of that.

    You might also have a look at the source for the RadioButtonListWithImages from uComponents, as it's pretty similar to what you are doing, except it reads the choices from prevalues.  http://ucomponents.codeplex.com/SourceControl/changeset/view/71319#1411268

    Hopefully this will get you started...let us know how you get along

    -Tom

  • Zobayer Rabbi 3 posts 23 karma points
    Jan 13, 2011 @ 07:19
    Zobayer Rabbi
    0

    Hi Tom,

     

    Thanks for your nice post. I am creating a custom control. I can show the document properties. how can update the property values?

     

    -Zobayer

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jan 13, 2011 @ 14:14
    Tom Fulton
    0

    Hi Zobayer,

    You can set them the same way you retrieve them, ie:

    childDoc.getProperty("yourPropertyAlias").Value = "newvalue";

    Once you make the change you'll need to publish and update the document cache for them to be live, something like:

    childDoc.Publish(User.GetCurrent());
    umbraco.library.UpdateDocumentCache(childDoc.Id);

    -Tom

     

Please Sign in or register to post replies

Write your reply to:

Draft