Umbraco Drop Down Property returning integer value
Hi,
We have unpublished page with drop down property. On accessing propertyy value in the code we are getting numeric value of this property where as we have entered text value in dropdown items.
Here is the code syntax we are using to fetch values from dropdown
Perhaps you can benefit from using the same approach as Maff describes in his blogpost about getting the Text rather than the id of the dropdown value?
Umbraco Drop Down Property returning integer value
Hi,
We have unpublished page with drop down property. On accessing propertyy value in the code we are getting numeric value of this property where as we have entered text value in dropdown items.
Here is the code syntax we are using to fetch values from dropdown
objContent= ApplicationContext.Current.Services.ContentService.GetById(1234);
objContent.GetValue("propertyalias");
Here "1234" is the pageID.
Please help me on this.
Hi Tarunjit
Perhaps you can benefit from using the same approach as Maff describes in his blogpost about getting the Text rather than the id of the dropdown value?
http://maffrigby.com/umbraco-the-getprevalues-method-using-datatype-name/
Hope this helps.
/Jan
..Or perhaps you can simply just use the .GetPrevalueAsString() method as describe d here https://our.umbraco.org/documentation/Reference/Querying/UmbracoHelper/ a bit down the page.
/Jan
is working on a reply...