I have a dropdown datatype and I'm trying to pull all of the prevalues into my Razor page. I'm new to dotnet and everything I've tried makes my site explode. Any help would be appreciated.
Is there a @using statement I should include? When I inject IDataTypeValueService into my razor page, it breaks with teh error:
The type or namespace name 'IDataTypeService' could not be found (are you missing a using directive or an assembly reference?)
For default Umbraco I can only find details on a 'DataTypeService' not a Value service, but perhaps it's what was meant? Handy to know where this sort of thing is in the documentation either way :3 It shows the usings needed for views.
The only mention of a DataTypeValueService I can find is a custom service in a tutorial for v8 done by Paul Seal.
How to get the prevalues from a dropdown
Hello all,
I have a dropdown datatype and I'm trying to pull all of the prevalues into my Razor page. I'm new to dotnet and everything I've tried makes my site explode. Any help would be appreciated.
Thanks
Hello Philip!
I belive you could use
IDataTypeValueService
. Inject it into your razor view by doing this:Then you could use it like this:
I hope this helps you get on the right track!
//Johannes
thank you Johannes.
Is there a
@using
statement I should include? When I inject IDataTypeValueService into my razor page, it breaks with teh error:The type or namespace name 'IDataTypeService' could not be found (are you missing a using directive or an assembly reference?)
Thanks again
For default Umbraco I can only find details on a 'DataTypeService' not a Value service, but perhaps it's what was meant? Handy to know where this sort of thing is in the documentation either way :3 It shows the usings needed for views.
The only mention of a DataTypeValueService I can find is a custom service in a tutorial for v8 done by Paul Seal.
Ah! Sorry, I was a bit quick there!
Yes!
Then you can do
//Johannes
Good deal. Thank you both!
is working on a reply...