Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi guys - hoping some brain cleverer than mine can help me. I have a Data Type in the CMS to categorise my News articles. Simple stuff.
I'd like to render our this on the front-end so that the user can filter the news articles. Obviously it would be ideal to get the values from the Data Type so that it's updated whenever new categories are added.
I've used the dataTypeService to do this as follows;
IDataTypeService dataTypeService = Services.DataTypeService;
IDataType dataType = dataTypeService.GetDataType(xxxx);
Which works beautifully, apart from the fact that the Data Types do not have consistent IDs when you move between environments. I was hoping this would be solved by restoring all my content from Live, but all my environments seemingly have different IDs...
For obvious reasons I'm not keen on using a hard coded ID anyway - there must be a better way?
Thanks awesome folks :)
I wrote some code which lets you get the values from backoffice dropdowns and use them on the front end.
Here is the blog post with the code.
I hope it helps.
Hi Paul, thank you so much for getting in touch (also, thank you for lots of your videos they're really helped me!).
I've had a look through the code and it all makes sense, however (stupid question coming) I've not actually built any new classes or models before, only macros and partial views etc, so I'm not sure where this code should actually live. Any pointers in the right direction would be massively welcome.
Many thanks again, Rowena
P.s. I've just noticed you're from Derby! Small world... (waves from Chesterfield).
Wow Chesterfield is very close, it is a small world.
I can show you how to do this over zoom if you like. Check out https://codeshare.co.uk/coaching
Message me on Twitter if you’d like to talk more about it or just book one of the free 15 minute slots.
Amazing thanks Paul - I have a couple of topics I'd really love to pick your brains on so if it's OK I'll book an hour with you... will gladly pay for your time to help save me spending days on it :)
Great looking forward to speaking to you.
At the moment I just have this week available. Ideally it would be good if you could book towards the beginning or end of a day.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted