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..
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...
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:
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.
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.
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
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...
Hello Tom, yes.. can you provide sample as how to achieve above functionality?
thank you
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:
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
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
Hi Zobayer,
You can set them the same way you retrieve them, ie:
Once you make the change you'll need to publish and update the document cache for them to be live, something like:
-Tom
is working on a reply...