asp.net - Image Not Displaying On Page -
i working on mvc 5 asp.net. when using razor syntax image not showing on web page otherwise same hard coded value working.
here code.
@{ var path = ""; } @foreach (movy in model) { if (a.image == null) { path = "~/content/images/c3.jpg"; } else { path = a.image; } <img src="@path" /> }
but when replace @path "~/content/images/c3.jpg" in source of image works.
you need resolve string in run time. use url.content
<img src="@url.content(path)" />
Comments
Post a Comment