You need to take a look at using Sitecore.Resources.Media.MediaManager to get the URL of the media library item.
Before you get there, you will get a field from this element and drop it onto FileField. When you have FileField, you can access MediaItem.
Item item = Sitecore.Context.Item; Sitecore.Data.Fields.ImageField imgField = ((Sitecore.Data.Fields.ImageField)item.Fields["MyImage"]); string url = Sitecore.Resources.Media.MediaManager.GetMediaUrl(imgField.MediaItem); string altText = imgField.Alt;
Sitecore Media Element Link
source share