<script id="newsTemplate" type="text/x-jquery-tmpl">
<div class="news_item" style="margin-left:0 !important;">
<div class="ni_image"><img src="@Url.Action("ViewImage", "Image", new {path = "${Thumbnail.Path}"})" alt="${Title}" /></div>
</div>
</script>
I am trying to render the image on page, and I have to pass the Thumbnail Path to image controller for that.
Jquery tmpl doesnt like it.
How can i fix this?
For background please see:
Replace divs with content from JSON call
The problem is caused by mixing server code (Razor) and client code.
You are using Razor (on the server) to create a link, but in order to create the link you need the
pathvalue which is in the${Thumbnail.Path}field (client-side) that Razor does not have access to.I would need to know a bit more about your code in order to help you come up with a solution.