Im trying to get the value that was selected in the back office, the filed is a Umbraco.DropDown which was datatype defined in the developer section
private void ContentServiceSaved(IContentService sender, Umbraco.Core.Events.SaveEventArgs<IContent> e)
{
var cs = new ContentService();
foreach (var myNode in e.SavedEntities.Where(x => x.HasProperty("myProperty")))
{
var x = myNode.GetValue("myOtherProperty");
// x ends up being a number 55 I want the drop down string value
}
For those trying to do this in Umbraco 7, I had the following solution. (Spread out into multiple lines for readability).
var propertyValue = myNode.getPropertyValue("myOtherProperty").ToString();
var propertyIntValue = int.Parse(propertyValue);
var selectedTextValue = Umbraco.GetPreValueAsString(propertyIntValue);
There might be a cleaner way to do it, but this gets me the desired string value for a dropdown or radio button list data type.
How to get the String value of a Umbraco.DropDown
Im trying to get the value that was selected in the back office, the filed is a Umbraco.DropDown which was datatype defined in the developer section
This worked for me :-)
For those trying to do this in Umbraco 7, I had the following solution. (Spread out into multiple lines for readability).
There might be a cleaner way to do it, but this gets me the desired string value for a dropdown or radio button list data type.
you could do it like this is Umbraco 7
Hello Aki,
I would like to list in frontend, Dropdown prevalues added in backoffice.
I hope what you have give, is for the selected item
is working on a reply...