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
I've set up a SQL DropDownList, and as specified my SQL returns Value and Text fields.
In my partial view macro I'm accessing @nameOfPage.nameOfSqlDropDown, but that's returning the text instead of the value. How do I get the value? The documentation doesn't appear to explain this (but please send me a link if I'm missing something).
Umbraco 6.2.5, uComponents 6.0
Looking through the source of the SQL DropDownList data type, it should indeed be the selected value that is stored on save.
Can you provide any more info of your current setup ?
Apologies - it turns out that it was a data error that made it look like a uComponents error. It is indeed working like it should. Crisis averted :)
I'm glad to hear that :)
Amusingly, here I am a year later, trying to do the exact opposite.
I can get the value through Razor (@item.myDropDown) but I can't figure out how to get the text! How do I do this? :)
Is this still Umbraco 6.2.5, uComponents 6.0 ?
As far as I can tell from looking at the source, uComponents only store the value in the database.
So, from what I can see, there is no way to retrieve the text directly.
What you might be able to do though, is to get all the prevalues from the data type and then find the correct text based on the saved value.
This should be doable by using the service api's and the data types guid.
Note however, that it will involve database access and therefor normally isn't intended for frontend use.
Hope this helps.
Thanks for that. It's a pity; the regular Umbraco dropdown allows you to get the text or the value easily, so I assumed that this "extended" one would do the same thing and that I was missing something obvious!
I can probably get away with database access; there aren't many instances where I need to do this and the site is only for internal use so it shouldn't slow things down too much.
Thanks for the pointers.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted