What's the best way to output a media item's URL from the code behind in 4.0.2.1? At the moment we have a user control with a Media Picker and then code needs to use the URL.
umbraco.
library.GetMedia gives us the node but it seems a bit silly to go back to XSLT to traverse the nodes...
I am using the above two lines to get the URL of the media element but getting the exception as "The type initializer for 'umbraco.cms.businesslogic.CMSNode' threw an exception."...any help at the earliest please
Getting a media item in code behind
What's the best way to output a media item's URL from the code behind in 4.0.2.1? At the moment we have a user control with a Media Picker and then code needs to use the URL.
umbraco.
library.GetMedia gives us the node but it seems a bit silly to go back to XSLT to traverse the nodes...
Thanks.
Tim
Comment author was deleted
umbraco.cms.businesslogic.media.Media mymedia = new umbraco.cms.businesslogic.media.Media(theid);
mymedia.getProperty("umbracoFile").Value.ToString()
Ahh I had a feeling there would be. Thanks Tim.
Tim
Hello..I am facing the same problem...
umbraco.cms.businesslogic.media.Media mymedia = new umbraco.cms.businesslogic.media.Media(theid);
mymedia.getProperty("umbracoFile").Value.ToString()
I am using the above two lines to get the URL of the media element but getting the exception as
"The type initializer for 'umbraco.cms.businesslogic.CMSNode' threw an exception."...any help at the earliest please
is working on a reply...