I am trying to display images dynamically using underscore templates

I need to have the relative path to the image and with Razor would be displaying something like this.

<img src="@Url.Content("~/images/"+ t.TopicCode +".jpg")" , class="img-responsive" />

what I am trying to do is displaying images dynamically using underscore.js template but

<img src="@Url.Content("~/images/"+<%= topic.TopicCode %> +".jpg")" , class="img-responsive" />

would give me a compilation error.

<img src="../images/<%= topic.TopicCode %>" , class="img-responsive" />

also doesnt find the image.

How could I could I go about in finding the path to these images while using underscore

Related posts

Recent Viewed