title: Rendering images by id using Sitecore 7 MVC and Razor
body: <p>I've got a checklist whose data source is a folder in the Sitecore Media Library.  Each of the 'checked' items in this field represents an image in this folder, so I'm expecting this checklist to compile into a string of pipe-delimited image ids.  Is it possible to use these ids to render the Media Library images on a View?</p>
  
  <p>This is an example of my ViewModel:</p>
  
  <pre><code>public class PageViewModel {
      public List&lt;string&gt; ImageIDs { get; set; }
  }
  </code></pre>
  
  <p>And this is an example of my Razor syntax code:</p>
  
  <pre><code>@foreach (var imageId in PageViewModel.ImageIDs) {
      &lt;div class="image-container"&gt;
          &lt;img src="@Url.Content(MediaManager.GetMediaUrl(imageId.MediaItem))"&gt;
      &lt;/div&gt;
  }
  </code></pre>