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,
I am using Dropdown list https://our.umbraco.org/documentation/using-umbraco/backoffice-overview/property-editors/Built-in-Property-Editors-v7/DropDown-List
and ContentService in MVC project. I get value from IContent like
contentItem.GetValue<string>("tier")
but it gives me int number not text value.
Is ContentService unable to return text instead of int value?
Umbraco 7.2.6.
The same is for the second option Dropdown list with published keys.
Should not dropdown list as value use defined text items? AngularJS in umbraco Backoffice shows it uses int numbers as values, like 200, 201, etc.
Hi LeszekP,
What if you are doing it something like this.
contentItem.GetPropertyValue
Like the documentation https://our.umbraco.org/documentation/using-umbraco/backoffice-overview/property-editors/Built-in-Property-Editors-v7/DropDown-List
@if (Model.Content.HasValue("superHero")) { <p>@Model.Content.GetPropertyValue("superHero")</p> }
Hope this helps,
/Dennis
I am working with ContentService to get content node from Umbraco. And it has not got GetPropertyValue method.
I checked it with IPublishedContent using Umbraco helper and it works.
I think the text:
Dropdown List Returns: String Displays a list of preset values. The value saved is a text value
Dropdown List Returns: String
Displays a list of preset values. The value saved is a text value
is misleading. As it is still saved as int (nodeid?) but when using publishedContent it returns text value not int.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Dropdown gives int not string (text)
Hi,
I am using Dropdown list https://our.umbraco.org/documentation/using-umbraco/backoffice-overview/property-editors/Built-in-Property-Editors-v7/DropDown-List
and ContentService in MVC project. I get value from IContent like
but it gives me int number not text value.
Is ContentService unable to return text instead of int value?
Umbraco 7.2.6.
The same is for the second option Dropdown list with published keys.
Should not dropdown list as value use defined text items? AngularJS in umbraco Backoffice shows it uses int numbers as values, like 200, 201, etc.
Hi LeszekP,
What if you are doing it something like this.
contentItem.GetPropertyValue
Like the documentation https://our.umbraco.org/documentation/using-umbraco/backoffice-overview/property-editors/Built-in-Property-Editors-v7/DropDown-List
Hope this helps,
/Dennis
I am working with ContentService to get content node from Umbraco. And it has not got GetPropertyValue method.
I checked it with IPublishedContent using Umbraco helper and it works.
I think the text:
is misleading. As it is still saved as int (nodeid?) but when using publishedContent it returns text value not int.
is working on a reply...