Checkboxlist - Get all values available not just set values.
I want to make a list of tags, which can be chosen from the checkboxlist,
so when i create a page, i can then select which tags is associated to the page.
But i also want to be able to display all available tags in the list, which is created in that datatype "checkboxlist", so not just the ones that have been chosen.
It is so i can display them on a page, so i can search with the tags.
You can get all prevalues of datatype with this code:
var dataType = ApplicationContext.Services.DataTypeService.GetDataTypeDefinitionByName("My Datatype Name");
var preValuesFromDataType = library.GetPreValues(dataType.Id);
Checkboxlist - Get all values available not just set values.
I want to make a list of tags, which can be chosen from the checkboxlist, so when i create a page, i can then select which tags is associated to the page.
But i also want to be able to display all available tags in the list, which is created in that datatype "checkboxlist", so not just the ones that have been chosen.
It is so i can display them on a page, so i can search with the tags.
But how can i manage this ?
Hi Andre
You can get all prevalues of datatype with this code:
Thanks,
Alex
i added your code to my controller, but when i try to write it out in my view, through my model, with this:
It says item is an object ? and it doesn't appear to hold any of the values i have added.
code from my controller:
Hi Andre
Try this code:
I tried your new code, but all i get is a "default" value, and nothing else.
In umbraco it looks like this:
but all it writes out are "default".
I only get a "default" value, and nothing else.
on the image you can see the values i have saved in the "tags" datatype.
What did you mean default value?
Check please here - .GetDataTypeDefinitionByName("tags");
tags - it should be the name of your datatype
Datatype setup:
So i should write "Article Tags" instead of tags ?
Andre, yes
Awesome :D That worked !
i am so sorry for missing that one.
Glad to help you, have a nice day!
is working on a reply...